Class: Actions::Katello::ContentView::IncrementalUpdates
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::ContentView::IncrementalUpdates
- Includes:
- Helpers::Presenter
- Defined in:
- app/lib/actions/katello/content_view/incremental_updates.rb
Instance Method Summary collapse
- #handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description, puppet_module_ids) ⇒ Object
- #humanized_name ⇒ Object
- #plan(version_environments, composite_version_environments, content, dep_solve, hosts, description) ⇒ Object
- #presenter ⇒ Object
- #run ⇒ Object
Instance Method Details
#handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description, puppet_module_ids) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/lib/actions/katello/content_view/incremental_updates.rb', line 40 def handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description, puppet_module_ids) concurrence do composite_version_environments.each do |version_environment| composite_version = version_environment[:content_view_version] environments = version_environment[:environments] new_components = composite_version.components.map { |component| old_new_version_map[component] }.compact if new_components.empty? fail _("Incremental update specified for composite %{name} version %{version}, but no components updated.") % {:name => composite_version.content_view.name, :version => composite_version.version} end action = plan_action(ContentViewVersion::IncrementalUpdate, composite_version, environments, :new_components => new_components, :description => description, :content => {:puppet_module_ids => puppet_module_ids}) output_for_version_ids << {:version_id => action.new_content_view_version.id, :output => action.output} end end end |
#humanized_name ⇒ Object
69 70 71 |
# File 'app/lib/actions/katello/content_view/incremental_updates.rb', line 69 def humanized_name _("Incremental Update") end |
#plan(version_environments, composite_version_environments, content, dep_solve, hosts, description) ⇒ Object
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 38 |
# File 'app/lib/actions/katello/content_view/incremental_updates.rb', line 7 def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description) old_new_version_map = {} output_for_version_ids = [] sequence do concurrence do version_environments.each do |version_environment| version = version_environment[:content_view_version] if version.content_view.composite? fail _("Cannot perform an incremental update on a Composite Content View Version (%{name} version version %{version}") % {:name => version.content_view.name, :version => version.version} end action = plan_action(ContentViewVersion::IncrementalUpdate, version, version_environment[:environments], :resolve_dependencies => dep_solve, :content => content, :description => description) old_new_version_map[version] = action.new_content_view_version output_for_version_ids << {:version_id => action.new_content_view_version.id, :output => action.output} end end if composite_version_environments.any? handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description, content[:puppet_module_ids]) end if hosts.any? && !content[:errata_ids].blank? errata = ::Katello::Erratum.with_identifiers(content[:errata_ids]) hosts = hosts.where(:id => ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id)) plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, content[:errata_ids]) end plan_self(:version_outputs => output_for_version_ids) end end |
#presenter ⇒ Object
73 74 75 |
# File 'app/lib/actions/katello/content_view/incremental_updates.rb', line 73 def presenter Presenters::IncrementalUpdatesPresenter.new(self) end |
#run ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'app/lib/actions/katello/content_view/incremental_updates.rb', line 60 def run output[:changed_content] = input[:version_outputs].map do |version_output| { :content_view_version => {:id => version_output[:version_id]}, :added_units => version_output[:output][:added_units] } end end |