module HammerCLIForeman::HostgroupUpdateCreateCommons

Public Class Methods

ask_password() click to toggle source
# File lib/hammer_cli_foreman/hostgroup.rb, line 15
def self.ask_password
  prompt = _("Enter the root password for the host group:") + " "
  HammerCLI.interactive_output.ask(prompt) { |q| q.echo = false }
end
included(base) click to toggle source
# File lib/hammer_cli_foreman/hostgroup.rb, line 5
def self.included(base)
  base.option "--parent", "PARENT_NAME",  _("Name of parent hostgroup")
  base.option ["--root-password"], "ROOT_PASSWORD",  _("Root password")
  base.option ["--ask-root-password", "--ask-root-pass"], "ASK_ROOT_PW", "",
              format: HammerCLI::Options::Normalizers::Bool.new
  base.option "--subnet6", "SUBNET6_NAME", _("Subnet IPv6 name")

  base.build_options without: %i[root_pass]
end

Public Instance Methods

request_params() click to toggle source
Calls superclass method
# File lib/hammer_cli_foreman/hostgroup.rb, line 20
def request_params
  params = super
  params['hostgroup']["parent_id"] ||= resolver.hostgroup_id('option_name' => option_parent) if option_parent

  params['hostgroup']['root_pass'] = option_root_password if option_root_password
  params['hostgroup']['root_pass'] = HammerCLIForeman::HostgroupUpdateCreateCommons::ask_password if option_ask_root_password

  params['hostgroup']['subnet6_id'] = resolver.subnet_id('option_name' => option_subnet6) if option_subnet6
  params
end

Private Instance Methods

proxy_id(name) click to toggle source
# File lib/hammer_cli_foreman/hostgroup.rb, line 33
def proxy_id(name)
  resolver.smart_proxy_id('option_name' => name) if name
end