Sha256: 1c41746ae28e0a488a54b2c5246df4c13fb2bbce70169402f2a5aa4c1aa03fa8

Contents?: true

Size: 1.12 KB

Versions: 15

Compression:

Stored size: 1.12 KB

Contents

module Actions
  module Katello
    module SyncPlan
      class Run < Actions::EntryAction
        include Actions::RecurringAction
        def plan(sync_plan)
          action_subject(sync_plan)
          User.as_anonymous_admin do
            fail _("No products in sync plan") unless sync_plan.products

            syncable_products = sync_plan.products.syncable
            syncable_roots = ::Katello::RootRepository.where(:product_id => syncable_products).has_url

            fail _("No syncable repositories found for selected products and options.") if syncable_roots.empty?

            plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync,
                        syncable_roots.map(&:library_instance))

            plan_self(:sync_plan_name => sync_plan.name)
          end
        end

        def humanized_name
          if input.try(:[], :sync_plan_name)
            _('Run Sync Plan %s') % (input[:sync_plan_name] || _('Unknown'))
          else
            _('Run Sync Plan')
          end
        end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katello-3.11.2 app/lib/actions/katello/sync_plan/run.rb
katello-3.10.2 app/lib/actions/katello/sync_plan/run.rb
katello-3.10.1.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.10.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.11.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.11.0 app/lib/actions/katello/sync_plan/run.rb
katello-3.11.0.rc2 app/lib/actions/katello/sync_plan/run.rb
katello-3.11.0.rc1 app/lib/actions/katello/sync_plan/run.rb
katello-3.10.0 app/lib/actions/katello/sync_plan/run.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.9.1 app/lib/actions/katello/sync_plan/run.rb
katello-3.10.0.rc1 app/lib/actions/katello/sync_plan/run.rb
katello-3.9.0 app/lib/actions/katello/sync_plan/run.rb
katello-3.9.0.rc2 app/lib/actions/katello/sync_plan/run.rb
katello-3.9.0.rc1 app/lib/actions/katello/sync_plan/run.rb