Sha256: aa5038de08494fbcbcf07cd2d896578fb2a7d198ee933ff033f9a5bf9e747cde

Contents?: true

Size: 1.57 KB

Versions: 29

Compression:

Stored size: 1.57 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,
                                                          :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

29 entries across 29 versions & 1 rubygems

Version Path
katello-3.2.1.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.2.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.2.0 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.2.0.rc3 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.2.0.rc2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.2.0.rc1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.1.0.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.1.0 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.1.0.rc2.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.0.2 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-2.4.5 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.1.0.rc1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.0.1 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-2.4.4 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.0.0 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-2.4.3 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.0.0.rc7 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-3.0.0.rc5 app/lib/actions/katello/content_view/remove_from_environment.rb
katello-2.4.2 app/lib/actions/katello/content_view/remove_from_environment.rb