Sha256: 251f2666b3dd5ed4f9e3193e6d072bcd84ff3e0157d8fa5bcf5c60c02023186f

Contents?: true

Size: 1.46 KB

Versions: 42

Compression:

Stored size: 1.46 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).compact) 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

42 entries across 42 versions & 1 rubygems

Version Path
katello-4.0.3 app/lib/actions/katello/sync_plan/run.rb
katello-3.18.5 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.2.1 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.2 app/lib/actions/katello/sync_plan/run.rb
katello-3.18.4 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.1.2 app/lib/actions/katello/sync_plan/run.rb
katello-3.18.3.1 app/lib/actions/katello/sync_plan/run.rb
katello-4.1.0.rc2.2 app/lib/actions/katello/sync_plan/run.rb
katello-4.1.0.rc2.1 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.1.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.18.3 app/lib/actions/katello/sync_plan/run.rb
katello-4.1.0.rc2 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.1 app/lib/actions/katello/sync_plan/run.rb
katello-4.1.0.rc1.1 app/lib/actions/katello/sync_plan/run.rb
katello-4.1.0.rc1 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.0 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.0.rc3.1 app/lib/actions/katello/sync_plan/run.rb
katello-4.0.0.rc3 app/lib/actions/katello/sync_plan/run.rb
katello-3.18.2.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.18.2 app/lib/actions/katello/sync_plan/run.rb