Sha256: d83652bbf03c14120b0dd0ee4e962225db7d1c6efff243bc24e5c4a7a587ec2a

Contents?: true

Size: 1.68 KB

Versions: 219

Compression:

Stored size: 1.68 KB

Contents

module Actions
  module Katello
    module ContentView
      class RemoveFromEnvironment < Actions::EntryAction
        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

        def finalize
          history = ::Katello::ContentViewHistory.find(input[:history_id])
          history.status = ::Katello::ContentViewHistory::SUCCESSFUL
          history.save!
        end

        def humanized_name
          _("Remove from Environment")
        end
      end
    end
  end
end

Version data entries

219 entries across 219 versions & 1 rubygems

Version Path
katello-3.5.0.rc2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.5.0.rc1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.5 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.4 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.0.2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.0.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.0 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.0.rc2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.4.0.rc1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.1.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.0.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.0 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.0.rc2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.0.rc1.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.3.0.rc1 app/lib/actions/katello/content_view/remove_from_environment.rb