Class: Actions::Katello::ContentView::RemoveFromEnvironment
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::ContentView::RemoveFromEnvironment
show all
- Includes:
- Helpers::ContentViewAutoPublisher
- Defined in:
- app/lib/actions/katello/content_view/remove_from_environment.rb
Instance Method Summary
collapse
#auto_publish_view, #auto_publish_views, included, #trigger_auto_publish
Instance Method Details
#finalize ⇒ Object
30
31
32
33
34
|
# File 'app/lib/actions/katello/content_view/remove_from_environment.rb', line 30
def finalize
history = ::Katello::ContentViewHistory.find(input[:history_id])
history.status = ::Katello::ContentViewHistory::SUCCESSFUL
history.save!
end
|
#humanized_name ⇒ Object
36
37
38
|
# File 'app/lib/actions/katello/content_view/remove_from_environment.rb', line 36
def humanized_name
_("Remove from Environment")
end
|
#plan(content_view, environment) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/lib/actions/katello/content_view/remove_from_environment.rb', line 7
def plan(content_view, environment)
action_subject(content_view)
content_view.check_remove_from_environment!(environment)
cv_env = ::Katello::ContentViewEnvironment.where(:content_view_id => content_view.id,
:environment_id => environment.id).first
if cv_env.nil?
fail _("Cannot remove content view from environment. Content view '%{view}' is not in lifecycle environment '%{env}'.") %
{view: content_view.name, env: environment.name}
end
history = ::Katello::ContentViewHistory.create!(:content_view_version => cv_env.content_view_version,
:environment => environment,
:user => ::User.current.login,
:status => ::Katello::ContentViewHistory::IN_PROGRESS,
:action => ::Katello::ContentViewHistory.actions[:removal],
:task => self.task)
plan_action(ContentViewEnvironment::Destroy, cv_env)
plan_self(history_id: history.id)
end
|