Class: HammerCLIKatello::ActivationKeyCommand::InfoCommand

Inherits:
InfoCommand
  • Object
show all
Defined in:
lib/hammer_cli_katello/activation_key.rb

Instance Method Summary collapse

Methods included from ResolverCommons

included

Instance Method Details

#extend_data(data) ⇒ Object



109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/hammer_cli_katello/activation_key.rb', line 109

def extend_data(data)
  # rubocop:disable Layout/LineLength
  # Hack to hide purpose addons if it's not set since it's not possible to hide the Fields::List values
  data["purpose_addons"].length.positive? ? data["purpose_addons"] = data["purpose_addons"] : data["purpose_addons"] = nil
  limit = data["unlimited_hosts"] ? _("Unlimited") : data["max_hosts"]

  data["format_consumed"] = _("%{consumed} of %{limit}") %
                            {
                              :consumed => data["usage_count"],
                              :limit => limit
                            }
  data
  # rubocop:enable Layout/LineLength
end

#request_paramsObject



41
42
43
44
45
46
47
48
49
# File 'lib/hammer_cli_katello/activation_key.rb', line 41

def request_params
  params = super
  if options.keys.any? { |o| o.match(/\Aoption_organization.*/) }
    params['organization_id'] = resolver.organization_id(
      resolver.scoped_options('organization', all_options)
    )
  end
  params
end