Class: Actions::Katello::SyncPlan::Run

Inherits:
EntryAction
  • Object
show all
Includes:
RecurringAction
Defined in:
app/lib/actions/katello/sync_plan/run.rb

Instance Method Summary collapse

Instance Method Details

#add_missing_task_group(sync_plan) ⇒ Object



32
33
34
35
36
37
38
# File 'app/lib/actions/katello/sync_plan/run.rb', line 32

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

#delay(delay_options, sync_plan) ⇒ Object



9
10
11
12
13
# File 'app/lib/actions/katello/sync_plan/run.rb', line 9

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

#humanized_inputObject



44
45
46
# File 'app/lib/actions/katello/sync_plan/run.rb', line 44

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

#humanized_nameObject



40
41
42
# File 'app/lib/actions/katello/sync_plan/run.rb', line 40

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

#plan(sync_plan) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/lib/actions/katello/sync_plan/run.rb', line 15

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

    sequence do
      plan_self(:sync_plan_name => sync_plan.name)
      if syncable_roots.any?
        plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync, syncable_roots.map(&:library_instance).compact, generate_applicability: false)
        plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => syncable_roots.map(&:library_instance).map(&:id))
      end
    end
  end
end

#rescue_strategyObject



48
49
50
# File 'app/lib/actions/katello/sync_plan/run.rb', line 48

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