Class: Actions::Katello::Host::Package::Remove

Inherits:
EntryAction
  • Object
show all
Includes:
Helpers::Presenter
Defined in:
app/lib/actions/katello/host/package/remove.rb

Instance Method Summary collapse

Instance Method Details

#humanized_inputObject



20
21
22
# File 'app/lib/actions/katello/host/package/remove.rb', line 20

def humanized_input
  [humanized_package_names.join(', ')] + super
end

#humanized_nameObject



16
17
18
# File 'app/lib/actions/katello/host/package/remove.rb', line 16

def humanized_name
  _("Remove package")
end

#humanized_package_namesObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/lib/actions/katello/host/package/remove.rb', line 24

def humanized_package_names
  input[:packages].inject([]) do |result, package|
    if package.is_a?(Hash)
      new_name = package.include?(:name) ? package[:name] : ""
      new_name += '-' + package[:version] if package.include?(:version)
      new_name += '.' + package[:release] if package.include?(:release)
      new_name += '.' + package[:arch] if package.include?(:arch)
      result << new_name
    else
      result << package
    end
  end
end

#plan(host, packages) ⇒ Object



8
9
10
11
12
13
14
# File 'app/lib/actions/katello/host/package/remove.rb', line 8

def plan(host, packages)
  action_subject(host, :packages => packages)
  plan_action(Pulp::Consumer::ContentUninstall,
              consumer_uuid: host.content_facet.uuid,
              type:          'rpm',
              args:          packages)
end

#presenterObject



38
39
40
41
# File 'app/lib/actions/katello/host/package/remove.rb', line 38

def presenter
  Helpers::Presenter::Delegated.new(
      self, planned_actions(Pulp::Consumer::ContentUninstall))
end