Module: HammerCLIForeman::CommonHostUpdateOptions

Included in:
Host::CreateCommand, Host::UpdateCommand
Defined in:
lib/hammer_cli_foreman/host.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/hammer_cli_foreman/host.rb', line 13

def self.included(base)
  base.apipie_options :without => [:host_parameters_attributes, :environment_id, :architecture_id, :domain_id,
        :puppet_proxy_id, :operatingsystem_id,
        # - temporarily disabled params until we add support for boolean options to apipie -
        :build, :managed, :enabled, :start,
        # - temporarily disabled params that will be removed from the api ------------------
        :provision_method, :capabilities, :flavour_ref, :image_ref, :start,
        :network, :cpus, :memory, :provider, :type, :tenant_id, :image_id,
        # ----------------------------------------------------------------------------------
        :compute_resource_id, :ptable_id] + base.declared_identifiers.keys

  base.option "--environment-id", "ENVIRONMENT_ID", " "
  base.option "--architecture-id", "ARCHITECTURE_ID", " "
  base.option "--domain-id", "DOMAIN_ID", " "
  base.option "--puppet-proxy-id", "PUPPET_PROXY_ID", " "
  base.option "--operatingsystem-id", "OPERATINGSYSTEM_ID", " "
  base.option "--partition-table-id", "PARTITION_TABLE_ID", " "
  base.option "--compute-resource-id", "COMPUTE_RESOURCE", " "
  base.option "--partition-table-id", "PARTITION_TABLE", " "

  base.option "--build", "BUILD", " ", :default => 'true',
    :format => HammerCLI::Options::Normalizers::Bool.new
  base.option "--managed", "MANAGED", " ", :default => 'true',
    :format => HammerCLI::Options::Normalizers::Bool.new
  base.option "--enabled", "ENABLED", " ",  :default => 'true',
    :format => HammerCLI::Options::Normalizers::Bool.new

  base.option "--parameters", "PARAMS", "Host parameters.",
    :format => HammerCLI::Options::Normalizers::KeyValueList.new
  base.option "--compute-attributes", "COMPUTE_ATTRS", "Compute resource attributes.",
    :format => HammerCLI::Options::Normalizers::KeyValueList.new
  base.option "--volume", "VOLUME", "Volume parameters", :multivalued => true,
    :format => HammerCLI::Options::Normalizers::KeyValueList.new
  base.option "--interface", "INTERFACE", "Interface parameters.", :multivalued => true,
    :format => HammerCLI::Options::Normalizers::KeyValueList.new

end

Instance Method Details

#request_paramsObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/hammer_cli_foreman/host.rb', line 51

def request_params
  params = super

  params['host']['build'] = build
  params['host']['managed'] = managed
  params['host']['enabled'] = enabled

  params['host']['ptable_id'] = partition_table_id
  params['host']['compute_resource_id'] = compute_resource_id
  params['host']['host_parameters_attributes'] = parameter_attributes
  params['host']['compute_attributes'] = compute_attributes || {}
  params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(volume_list)
  if compute_resource_id
    params['host']['compute_attributes']['interfaces_attributes'] = nested_attributes(interface_list)
    params['host']['compute_attributes']['nics_attributes'] = nested_attributes(interface_list)
  else
    params['host']['interfaces_attributes'] = nested_attributes(interface_list)
  end

  params
end