5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/lib/actions/katello/content_view/remove_from_environment.rb', line 5
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,
:task => self.task)
plan_action(ContentViewEnvironment::Destroy, cv_env)
plan_self(history_id: history.id)
end
|