# File lib/hammer_cli_foreman/operating_system.rb, line 153 def base_action_params {"operatingsystem_id" => option_id} end
# File lib/hammer_cli_foreman/operating_system.rb, line 174 def create_default_template(tpl_kind_name) params = { "os_default_template" => { "config_template_id" => option_config_template_id, "template_kind_name" => tpl_kind_name } }.merge base_action_params HammerCLIForeman.record_to_common_format(resource.call(:create, params)) end
# File lib/hammer_cli_foreman/operating_system.rb, line 185 def execute tpl_kind_name = option_type_name tpl = template_exist? tpl_kind_name if tpl update_default_template tpl print_message(success_message, tpl) if success_message else tpl = create_default_template tpl_kind_name print_message(success_message, tpl) if success_message end HammerCLI::EX_OK end
# File lib/hammer_cli_foreman/operating_system.rb, line 147 def option_type_name tpl = HammerCLIForeman.collection_to_common_format( HammerCLIForeman.foreman_resource!(:config_templates).call(:show, {"id" => option_config_template_id})) tpl[0]["template_kind_name"] end
# File lib/hammer_cli_foreman/operating_system.rb, line 157 def template_exist?(tpl_kind_name) templates = HammerCLIForeman.collection_to_common_format(resource.call(:index, base_action_params)) templates.find { |p| p["template_kind_name"] == tpl_kind_name} end
# File lib/hammer_cli_foreman/operating_system.rb, line 162 def update_default_template(tpl) params = { "id" => tpl["id"], "os_default_template" => { "config_template_id" => option_config_template_id, "template_kind_id" => tpl["template_kind_id"] } }.merge base_action_params HammerCLIForeman.record_to_common_format(resource.call(:update, params)) end
Generated with the Darkfish Rdoc Generator 2.