Class: HammerCLIKatello::ProductContentBase::ProductContentCommand

Inherits:
ListCommand
  • Object
show all
Defined in:
lib/hammer_cli_katello/product_content.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ListCommand

build_options

Methods included from ResolverCommons

included

Class Method Details

.setupObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hammer_cli_katello/product_content.rb', line 4

def self.setup
  desc _("List associated products")
  command_name "product-content"

  output do
    from :content do
      field :id, _("Id")
      field :name, _("Name")
      field :type, _("Type")
      field :contentUrl, _("Url")
      field :gpgUrl, _("GPG Key")
      field :label, _("Label")
    end
    field :enabled, _("Default Enabled?"), Fields::Boolean
    field :override_description, _("Override")
  end
  build_options
end

Instance Method Details

#extend_data(mod) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hammer_cli_katello/product_content.rb', line 23

def extend_data(mod)
  formatted_overrides = mod["overrides"].map do |override|
    value = override['value']
    if override['name'] == "enabled"
      value = override['value'] ? '1' : '0'
    end
    "#{override['name']}:#{value}"
  end
  mod["override_description"] = formatted_overrides.join(", ")
  mod
end