Sha256: 1eedd496cef58618b9ea56dd3239437653c91c579d439a6d63681d492d308d18

Contents?: true

Size: 1.45 KB

Versions: 37

Compression:

Stored size: 1.45 KB

Contents

module Actions
  module Katello
    module SyncPlan
      class Run < Actions::EntryAction
        include Actions::RecurringAction

        middleware.use Actions::Middleware::RecurringLogic

        def delay(delay_options, sync_plan)
          input.update :sync_plan_name => sync_plan.name
          add_missing_task_group(sync_plan)
          super delay_options, sync_plan
        end

        def plan(sync_plan)
          add_missing_task_group(sync_plan)
          action_subject(sync_plan)
          User.as_anonymous_admin do
            syncable_products = sync_plan.products.syncable
            syncable_roots = ::Katello::RootRepository.where(:product_id => syncable_products).has_url

            plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync, syncable_roots.map(&:library_instance)) unless syncable_roots.empty?
            plan_self(:sync_plan_name => sync_plan.name)
          end
        end

        def add_missing_task_group(sync_plan)
          if sync_plan.task_group.nil?
            sync_plan.task_group = ::Katello::SyncPlanTaskGroup.create!
            sync_plan.save!
          end
          task.add_missing_task_groups(sync_plan.task_group)
        end

        def humanized_name
          _('Run Sync Plan:')
        end

        def humanized_input
          input.fetch(:sync_plan_name, _('Unknown'))
        end

        def rescue_strategy
          Dynflow::Action::Rescue::Skip
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
katello-3.16.0.rc5 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc4.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.3.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.3 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc4 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc3.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.2 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc3 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc2.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc2 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.1.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc1.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.16.0.rc1 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.0.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.0 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.0.rc2 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.0.rc1.3 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.0.rc1.2 app/lib/actions/katello/sync_plan/run.rb
katello-3.15.0.rc1.1 app/lib/actions/katello/sync_plan/run.rb