Sha256: fc599ff02581feb73177da4dcdcbd3c7f8ef632974eba9619170a350685bf7ac

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

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

          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)

            ::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

          private

          def consumer
            @consumer ||= ::Katello::Resources::Candlepin::UpstreamCandlepinResource.upstream_consumer
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-3.17.0.rc2.2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-3.17.0.rc2.1 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-3.17.0.rc2 app/lib/actions/katello/organization/simple_content_access/toggle.rb
katello-3.17.0.rc1 app/lib/actions/katello/organization/simple_content_access/toggle.rb