Class: Actions::Katello::ContentView::PromoteToEnvironment
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::ContentView::PromoteToEnvironment
- Defined in:
- app/lib/actions/katello/content_view/promote_to_environment.rb
Instance Method Summary collapse
- #finalize ⇒ Object
- #humanized_name ⇒ Object
- #plan(version, environment, description, incremental_update = false) ⇒ Object
- #rescue_strategy_for_self ⇒ Object
- #trigger_capsule_sync(_execution_plan) ⇒ Object
Instance Method Details
#finalize ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/lib/actions/katello/content_view/promote_to_environment.rb', line 47 def finalize environment = ::Katello::KTEnvironment.find(input[:environment_id]) ::Katello::ContentView.find(input[:content_view_id]).update_host_statuses(environment) history = ::Katello::ContentViewHistory.find(input[:history_id]) history.status = ::Katello::ContentViewHistory::SUCCESSFUL history.save! end |
#humanized_name ⇒ Object
39 40 41 |
# File 'app/lib/actions/katello/content_view/promote_to_environment.rb', line 39 def humanized_name _("Promotion to Environment") end |
#plan(version, environment, description, incremental_update = false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/lib/actions/katello/content_view/promote_to_environment.rb', line 6 def plan(version, environment, description, incremental_update = false) history = ::Katello::ContentViewHistory.create!(:content_view_version => version, :user => ::User.current.login, :environment => environment, :task => self.task, :status => ::Katello::ContentViewHistory::IN_PROGRESS, :action => 'promotion', :notes => description) sequence do plan_action(ContentView::AddToEnvironment, version, environment) concurrence do version.archived_repos.each do |repository| sequence do plan_action(Repository::CloneToEnvironment, repository, environment) end end repos_to_delete(version, environment).each do |repo| plan_action(Repository::Destroy, repo, :skip_environment_update => true) end end plan_action(Candlepin::Environment::SetContent, version.content_view, environment, version.content_view.content_view_environment(environment)) plan_action(Katello::Foreman::ContentUpdate, environment, version.content_view) plan_action(ContentView::ErrataMail, version.content_view, environment) if incremental_update && sync_proxies?(environment) plan_action(ContentView::CapsuleSync, version.content_view, environment) end plan_self(history_id: history.id, environment_id: environment.id, user_id: ::User.current.id, environment_name: environment.name, content_view_id: version.content_view.id, incremental_update: incremental_update) end end |
#rescue_strategy_for_self ⇒ Object
43 44 45 |
# File 'app/lib/actions/katello/content_view/promote_to_environment.rb', line 43 def rescue_strategy_for_self Dynflow::Action::Rescue::Skip end |
#trigger_capsule_sync(_execution_plan) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'app/lib/actions/katello/content_view/promote_to_environment.rb', line 56 def trigger_capsule_sync(_execution_plan) environment = ::Katello::KTEnvironment.find(input[:environment_id]) if !input[:incremental_update] && sync_proxies?(environment) ForemanTasks.async_task(ContentView::CapsuleSync, ::Katello::ContentView.find(input[:content_view_id]), environment) end end |