Sha256: 5b3150d14760133b98f70b35eb651081d408b5f78883b334f46669202762bb7a

Contents?: true

Size: 1.48 KB

Versions: 65

Compression:

Stored size: 1.48 KB

Contents

module Actions
  module Katello
    module Organization
      module SimpleContentAccess
        class Toggle < Actions::AbstractAsyncTask
          middleware.use Actions::Middleware::PropagateCandlepinErrors
          include Helpers::Notifications

          SIMPLE_CONTENT_ACCESS_DISABLED_VALUE = "entitlement".freeze
          SIMPLE_CONTENT_ACCESS_ENABLED_VALUE = "org_environment".freeze

          attr_reader :organization

          def plan(organization_id)
            @organization = ::Organization.find(organization_id)
            action_subject organization
            ::Katello::Resources::Candlepin::UpstreamConsumer.update(
              "#{consumer['apiUrl']}#{consumer['uuid']}",
              consumer['idCert']['cert'],
              consumer['idCert']['key'],
              nil,
              {contentAccessMode: content_access_mode_value}
            )

            plan_action(::Actions::Katello::Organization::ManifestRefresh, organization)
          end

          def failure_notification(plan)
            task_error_notification.deliver!(
              :subject => subject_organization,
              :task => get_foreman_task(plan)
            )
          end

          def success_notification(_plan)
            task_success_notification.deliver!(
              subject_organization
            )
          end

          private

          def consumer
            @consumer ||= @organization.owner_details['upstreamConsumer']
          end
        end
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
katello-4.3.0.rc1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.2.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.2.0.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.1.4 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.0.3 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.2.0.1.rc3 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-3.18.5 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.2.0.1.rc2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.2.0.rc2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.1.3 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.2.0.rc1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.0.2.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.1.2.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.0.2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.1.2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-3.18.4 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.1.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.1.0 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-4.0.1.2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-3.18.3.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb