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
.ask_password ⇒ Object
60 61 62 63 |
# File 'lib/hammer_cli_foreman/host.rb', line 60 def self.ask_password prompt = "Enter the root password for the host: " ask(prompt) {|q| q.echo = false} end |
.included(base) ⇒ Object
11 12 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 50 51 52 53 54 55 56 57 58 |
# File 'lib/hammer_cli_foreman/host.rb', line 11 def self.included(base) 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 "--puppetclass-ids", "PUPPETCLASS_IDS", " ", :format => HammerCLI::Options::Normalizers::List.new base.option "--root-password", "ROOT_PW", " " base.option "--ask-root-password", "ASK_ROOT_PW", " ", :format => HammerCLI::Options::Normalizers::Bool.new = {} [:default] = 'true' if base.action.to_sym == :create [:format] = HammerCLI::Options::Normalizers::Bool.new base.option "--managed", "MANAGED", " ", [:format] = HammerCLI::Options::Normalizers::Bool.new base.option "--build", "BUILD", " ", [:format] = HammerCLI::Options::Normalizers::Bool.new base.option "--enabled", "ENABLED", " ", 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 base.option "--provision-method", "METHOD", " ", :format => HammerCLI::Options::Normalizers::Enum.new(['build', 'image']) base. :without => [ # - temporarily disabled params until they are fixed in API ------------------------ # issue #3884 :puppet_class_ids, # - 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, # - avoids future conflicts as :root_pass is currently missing in the api docs :root_pass, # ---------------------------------------------------------------------------------- :ptable_id, :host_parameters_attributes] end |
Instance Method Details
#request_params ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/hammer_cli_foreman/host.rb', line 65 def request_params params = super params['host']['build'] = option_build unless option_build.nil? params['host']['managed'] = option_managed unless option_managed.nil? params['host']['enabled'] = option_enabled unless option_enabled.nil? params['host']['puppetclass_ids'] = option_puppetclass_ids unless option_puppetclass_ids.nil? params['host']['ptable_id'] = option_partition_table_id unless option_partition_table_id.nil? params['host']['compute_resource_id'] = option_compute_resource_id unless option_compute_resource_id.nil? params['host']['host_parameters_attributes'] = parameter_attributes params['host']['compute_attributes'] = option_compute_attributes || {} params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(option_volume_list) if option_compute_resource_id params['host']['compute_attributes']['interfaces_attributes'] = nested_attributes(option_interface_list) params['host']['compute_attributes']['nics_attributes'] = nested_attributes(option_interface_list) else params['host']['interfaces_attributes'] = nested_attributes(option_interface_list) end params['host']['root_pass'] = option_root_password unless option_root_password.nil? if option_ask_root_password params['host']['root_pass'] = HammerCLIForeman::CommonHostUpdateOptions::ask_password end params end |