Sha256: d1bf9034d2a983447c1199b5d5f27febc85beedc46525dda6fabfe6b6694d728

Contents?: true

Size: 1.93 KB

Versions: 13

Compression:

Stored size: 1.93 KB

Contents

module Actions
  module Katello
    module CapsuleContent
      class Sync < ::Actions::EntryAction
        def resource_locks
          :link
        end

        input_format do
          param :name
        end

        def humanized_name
          _("Synchronize smart proxy")
        end

        def humanized_input
          input['smart_proxy'].nil? || input['smart_proxy']['name'].nil? ? super : ["'#{input['smart_proxy']['name']}'"] + super
        end

        def plan(smart_proxy, options = {})
          action_subject(smart_proxy)
          smart_proxy.verify_ueber_certs
          environment_id = options.fetch(:environment_id, nil)
          environment = ::Katello::KTEnvironment.find(environment_id) if environment_id
          repository_id = options.fetch(:repository_id, nil)
          repository = ::Katello::Repository.find(repository_id) if repository_id
          content_view_id = options.fetch(:content_view_id, nil)
          content_view = ::Katello::ContentView.find(content_view_id) if content_view_id

          fail _("Action not allowed for the default smart proxy.") if smart_proxy.pulp_primary?

          refresh_options = options.merge(content_view: content_view,
                                             environment:  environment,
                                             repository: repository)
          sequence do
            if smart_proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE)
              plan_action(Actions::Pulp::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
            end

            if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE)
              plan_action(Actions::Pulp3::CapsuleContent::RefreshContentGuard, smart_proxy)
              plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
            end
            plan_action(SyncCapsule, smart_proxy, refresh_options)
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
katello-4.0.1.2 app/lib/actions/katello/capsule_content/sync.rb
katello-4.1.0.rc2.2 app/lib/actions/katello/capsule_content/sync.rb
katello-4.1.0.rc2.1 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.1.1 app/lib/actions/katello/capsule_content/sync.rb
katello-4.1.0.rc2 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.1 app/lib/actions/katello/capsule_content/sync.rb
katello-4.1.0.rc1.1 app/lib/actions/katello/capsule_content/sync.rb
katello-4.1.0.rc1 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.0 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.0.rc3.1 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.0.rc3 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.0.rc2 app/lib/actions/katello/capsule_content/sync.rb
katello-4.0.0.rc1 app/lib/actions/katello/capsule_content/sync.rb