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
39
40
41
42
43
44
45
|
# File 'app/lib/actions/katello/content_view/publish.rb', line 8
def plan(content_view, description = "")
action_subject(content_view)
content_view.check_ready_to_publish!
version = content_view.create_new_version(description)
library = content_view.organization.library
history = ::Katello::ContentViewHistory.create!(:content_view_version => version, :user => ::User.current.login,
:status => ::Katello::ContentViewHistory::IN_PROGRESS, :task => self.task)
sequence do
plan_action(ContentView::AddToEnvironment, version, library)
concurrence do
content_view.repositories_to_publish.each do |repository|
sequence do
clone_to_version = plan_action(Repository::CloneToVersion, repository, version)
plan_action(Repository::CloneToEnvironment, clone_to_version.new_repository, library)
end
end
sequence do
has_modules = content_view.puppet_modules.any? || content_view.components.any? { |component| component.puppet_modules.any? }
plan_action(ContentViewPuppetEnvironment::CreateForVersion, version)
plan_action(ContentViewPuppetEnvironment::Clone, version, :environment => library,
:puppet_modules_present => has_modules)
end
repos_to_delete(content_view).each do |repo|
plan_action(Repository::Destroy, repo, :skip_environment_update => true, :planned_destroy => true)
end
end
plan_action(ContentView::UpdateEnvironment, content_view, library)
plan_action(Katello::Foreman::ContentUpdate, library, content_view)
plan_action(ContentView::ErrataMail, content_view, library)
plan_self(history_id: history.id, content_view_id: content_view.id,
environment_id: library.id, user_id: ::User.current.id)
end
end
|