Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36871 - Fix incremental update concurrency #10781

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions app/lib/actions/katello/content_view/incremental_updates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,41 @@ module ContentView
class IncrementalUpdates < Actions::EntryAction
include Helpers::Presenter

def version_environments_by_cv_id(version_environments)
by_content_view = {}
version_environments.each do |version_environment|
by_content_view[version_environment[:content_view_version].content_view.id] ||= []
by_content_view[version_environment[:content_view_version].content_view.id] << version_environment
end
by_content_view
end

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.generated?
fail _("Cannot perform an incremental update on a Generated Content View Version (%{name} version version %{version}") %
{:name => version.content_view.name, :version => version.version}
version_environments_by_cv_id(version_environments).each_value do |version_environments_for_cv|
sequence do
version_environments_for_cv.each do |version_environment|
version = version_environment[:content_view_version]
if version.content_view.generated?
fail _("Cannot perform an incremental update on a Generated Content View Version (%{name} version version %{version}") %
{:name => version.content_view.name, :version => version.version}
end

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 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

Expand Down
Loading