Module: HammerCLIForeman::SmartVariableUpdateCreateCommons

Included in:
HammerCLIForeman::SmartVariable::CreateCommand, HammerCLIForeman::SmartVariable::UpdateCommand
Defined in:
lib/hammer_cli_foreman/smart_variable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/hammer_cli_foreman/smart_variable.rb', line 5

def self.included(base)
  base.option "--variable-type", "VARIABLE_TYPE", _("Type of the variable"),
              :format => HammerCLI::Options::Normalizers::Enum.new(
                  ['string', 'boolean', 'integer', 'real', 'array', 'hash', 'yaml', 'json'])
  base.option "--validator-type", "VALIDATOR_TYPE", _("Type of the validator"),
              :format => HammerCLI::Options::Normalizers::Enum.new(['regexp', 'list', ''])
  base.option "--override-value-order", "OVERRIDE_VALUE_ORDER", _("The order in which values are resolved"),
              :format => HammerCLI::Options::Normalizers::List.new
  base.option '--default-value', 'VALUE', _('Value to use when there is no match')

  base.build_options :without => [:variable_type, :validator_type, :override_value_order]
end

Instance Method Details

#request_paramsObject



18
19
20
21
22
23
# File 'lib/hammer_cli_foreman/smart_variable.rb', line 18

def request_params
  params = super
  override_order = params['smart_variable']['override_value_order']
  params['smart_variable']['override_value_order'] = override_order.join("\n") if override_order.is_a?(Array)
  params
end