Class: Actions::Katello::ContentView::Promote

Inherits:
EntryAction
  • Object
show all
Extended by:
ApipieDSL::Class
Includes:
JailConcern::ContentView, JailConcern::Organization, ObservableAction
Defined in:
app/lib/actions/katello/content_view/promote.rb

Defined Under Namespace

Classes: Jail

Instance Method Summary collapse

Methods included from JailConcern::ContentView

#content_view_id, #content_view_label, #content_view_name, included

Methods included from JailConcern::Organization

included, #organization_id, #organization_label, #organization_name

Instance Method Details

#environmentsObject



26
27
28
# File 'app/lib/actions/katello/content_view/promote.rb', line 26

def environments
  input['environments']
end

#plan(version, environments, is_force = false, description = nil, incremental_update = false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/lib/actions/katello/content_view/promote.rb', line 8

def plan(version, environments, is_force = false, description = nil, incremental_update = false)
  action_subject(version.content_view)
  version.check_ready_to_promote!(environments)
  ::Katello::Util::CandlepinRepositoryChecker.check_repositories_for_promote!(version)

  fail ::Katello::HttpErrors::BadRequest, _("Cannot promote environment out of sequence. Use force to bypass restriction.") if !is_force && !version.promotable?(environments)

  # Pass the environments as input in order to make them accessible to UI alerts
  plan_self(environments: environments.map(&:name))
  environments.each do |environment|
    sequence do
      plan_action(Katello::ContentViewVersion::BeforePromoteHook, :id => version.id)
      plan_action(ContentView::PromoteToEnvironment, version, environment, description, incremental_update)
      plan_action(Katello::ContentViewVersion::AfterPromoteHook, :id => version.id)
    end
  end
end