Project

General

Profile

Bug #5426

Updated by Dominic Cleal almost 10 years ago

Hello. 

 I have a problems with assigning the template to the OS using "hammer os add-config-template" command.  
 See the examples below: 

 foreman ~ # hammer os list 
 ---|------------------------|--------------|------- 
 ID | NAME                     | RELEASE NAME | FAMILY 
 ---|------------------------|--------------|------- 
 1    | CentOS 6.5               |                | Redhat 
 ---|------------------------|--------------|------- 




 foreman ~ # hammer os info --id=1 
 Id:                   1 
 Name:                 CentOS 6.5 
 Release name: 
 Family:               Redhat 
 Installation media: My_CentOS_mirror 
 Architectures:        x86_64 
 Partition tables:     My_CentOS_partition_table 
 Config templates:     My_CentOS_Kickstart_Default, My_CentOS_Kickstart_default_PXElinux 
 Parameters: 
  1) ntp-server => ntp.example.com 
  2) time-zone => Europe/Prague 


 I'm trying to assing the configtemplate to the OS: 

 <pre> 
 foreman ~ # *hammer --debug os add-config-template --id 1 --config-template-id 39* 
 [ INFO 2014-04-24 12:10:01 Init] Initialization of Hammer CLI (0.1.0) has started... 
 [DEBUG 2014-04-24 12:10:01 Init] Running at ruby 1.8.7-p352 
 [ INFO 2014-04-24 12:10:01 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded                                                                                                                                                              
 [ INFO 2014-04-24 12:10:01 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded                                                                                                                                                   
 [DEBUG 2014-04-24 12:10:01 Connection] Registered: foreman 
 [ INFO 2014-04-24 12:10:01 API] GET /apidoc/apipie_checksum 
 [DEBUG 2014-04-24 12:10:01 API] Params: {} 
 [DEBUG 2014-04-24 12:10:01 API] Response { 
     "checksum" => "0b5e76b2acfee115abb8817b83e8e8b1" 
 } 
 [ INFO 2014-04-24 12:10:02 Modules] Extension module hammer_cli_foreman (0.1.0) loaded 
 [DEBUG 2014-04-24 12:10:02 Init] Using locale 'en' 
 [DEBUG 2014-04-24 12:10:02 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/locale' 
 [DEBUG 2014-04-24 12:10:02 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.0/locale' 
 [ INFO 2014-04-24 12:10:02 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} 
 [ INFO 2014-04-24 12:10:02 HammerCLIForeman::OperatingSystem] Called with options: {} 
 [ INFO 2014-04-24 12:10:02 HammerCLIForeman::AssociatingCommands::ConfigTemplate::AddConfigTemplateCommand] Called with options: {"associated_id"=>"39", "option_id"=>"1"} 
 [ INFO 2014-04-24 12:10:02 API] GET /apidoc/apipie_checksum 
 [DEBUG 2014-04-24 12:10:02 API] Params: {} 
 [DEBUG 2014-04-24 12:10:02 API] Response { 
     "checksum" => "0b5e76b2acfee115abb8817b83e8e8b1" 
 } 
 [ INFO 2014-04-24 12:10:02 API] GET /api/operatingsystems/1 
 [DEBUG 2014-04-24 12:10:02 API] Params: {} 
 [DEBUG 2014-04-24 12:10:02 API] Response { 
         "config_templates" => [ 
         [0] { 
                           "name" => "My_CentOS_Kickstart_Default", 
                             "id" => 38, 
             "template_kind_name" => "provision", 
               "template_kind_id" => 4 
         }, 
         [1] { 
                           "name" => "My_CentOS_Kickstart_default_PXElinux", 
                             "id" => 39, 
             "template_kind_name" => "PXELinux", 
               "template_kind_id" => 1 
         } 
     ], 
            "architectures" => [ 
         [0] { 
               "id" => 1, 
             "name" => "x86_64" 
         } 
     ], 
              "description" => nil, 
                    "media" => [ 
         [0] { 
             "name" => "My_CentOS_mirror", 
               "id" => 7 
         } 
     ], 
                 "fullname" => "CentOS 6.5", 
     "os_default_templates" => [], 
               "parameters" => [ 
         [0] { 
             "value" => "ntp.example.com", 
              "name" => "ntp-server", 
                "id" => 1 
         }, 
         [1] { 
             "value" => "Europe/Prague", 
              "name" => "time-zone", 
                "id" => 2 
         } 
     ], 
                    "major" => "6", 
                  "ptables" => [ 
         [0] { 
               "id" => 11, 
             "name" => "My_CentOS_partition_table" 
         } 
     ], 
                    "minor" => "5", 
                     "name" => "CentOS", 
                       "id" => 1, 
               "updated_at" => "2014-04-24T09:23:06Z", 
             "release_name" => nil, 
                   "family" => "Redhat", 
                   "images" => [], 
               "created_at" => "2014-04-24T09:23:06Z" 
 } 
 [ INFO 2014-04-24 12:10:02 API] GET /apidoc/apipie_checksum 
 [DEBUG 2014-04-24 12:10:02 API] Params: {} 
 [DEBUG 2014-04-24 12:10:02 API] Response { 
     "checksum" => "0b5e76b2acfee115abb8817b83e8e8b1" 
 } 
 [ INFO 2014-04-24 12:10:02 API] GET /api/config_templates/39 
 [DEBUG 2014-04-24 12:10:02 API] Params: {} 
 [DEBUG 2014-04-24 12:10:02 API] Response { 
      "os_default_templates" => [], 
                      "name" => "My_CentOS_Kickstart_default_PXElinux", 
                        "id" => 39, 
                "updated_at" => "2014-04-24T09:24:03Z", 
          "operatingsystems" => [ 
         [0] { 
             "fullname" => "CentOS 6.5", 
                 "name" => "CentOS", 
                   "id" => 1 
         } 
     ], 
             "audit_comment" => nil, 
                   "snippet" => false, 
     "template_combinations" => [], 
                  "template" => "default linux\nlabel linux\nkernel <%= @kernel %>\nipappend 2\nappend initrd=<%= @initrd %> ks=<%= foreman_url(\"provision\")%>?static=yes ksdevice=bootif network kssendmac text cmdline RUNKS=1 sshd=1 console=ttyS0,115200 ip=<%= @host.ip %> netmask=<%= @host.subnet.mask %> gateway=<%= @host.subnet.gateway %> dns=<%= @host.subnet.dns_primary %>\n", 
                "created_at" => "2014-04-24T09:24:03Z", 
        "template_kind_name" => "PXELinux", 
          "template_kind_id" => 1 
 } 
 [ INFO 2014-04-24 12:10:02 API] GET /apidoc/apipie_checksum 
 [DEBUG 2014-04-24 12:10:02 API] Params: {} 
 [DEBUG 2014-04-24 12:10:02 API] Response { 
     "checksum" => "0b5e76b2acfee115abb8817b83e8e8b1" 
 } 
 [ INFO 2014-04-24 12:10:02 API] PUT /api/operatingsystems/1 
 [DEBUG 2014-04-24 12:10:02 API] Params: { 
     "operatingsystem" => { 
         "config_template_ids" => [ 
             [0] 38, 
             [1] 39 
         ] 
     } 
 } 
 [DEBUG 2014-04-24 12:10:03 API] Response { 
         "config_templates" => [ 
         [0] { 
                           "name" => "My_CentOS_Kickstart_Default", 
                             "id" => 38, 
             "template_kind_name" => "provision", 
               "template_kind_id" => 4 
         }, 
         [1] { 
                           "name" => "My_CentOS_Kickstart_default_PXElinux", 
                             "id" => 39, 
             "template_kind_name" => "PXELinux", 
               "template_kind_id" => 1 
         } 
     ], 
            "architectures" => [ 
         [0] { 
               "id" => 1, 
             "name" => "x86_64" 
         } 
     ], 
              "description" => nil, 
                    "media" => [ 
         [0] { 
             "name" => "My_CentOS_mirror", 
               "id" => 7 
         } 
     ], 
                 "fullname" => "CentOS 6.5", 
     "os_default_templates" => [], 
               "parameters" => [ 
         [0] { 
             "value" => "ntp.example.com", 
              "name" => "ntp-server", 
                "id" => 1 
         }, 
         [1] { 
             "value" => "Europe/Prague", 
              "name" => "time-zone", 
                "id" => 2 
         } 
     ], 
                    "major" => "6", 
                  "ptables" => [ 
         [0] { 
               "id" => 11, 
             "name" => "My_CentOS_partition_table" 
         } 
     ], 
                    "minor" => "5", 
                     "name" => "CentOS", 
                       "id" => 1, 
               "updated_at" => "2014-04-24T09:23:06Z", 
             "release_name" => nil, 
                   "family" => "Redhat", 
                   "images" => [], 
               "created_at" => "2014-04-24T09:23:06Z" 
 } 
 </pre> 

 


 From the attached screenshot foreman1.png you can see nothing happened. 

 If I manually submit the templates using web GUI (screenshot foreman2.png) - everything is working fine. 

 Foreman/hammer details: 
 foreman ~ # rpm -qa | egrep 'foreman|hammer' 
 foreman-release-1.5.0-0.1.RC1.el6.noarch 
 rubygem-foreman_api-0.1.11-1.el6.noarch 
 foreman-installer-1.5.0-0.1.RC1.el6.noarch 
 rubygem-hammer_cli-0.1.0-1.el6.noarch 
 foreman-proxy-1.5.0-0.1.RC1.el6.noarch 
 foreman-1.5.0-0.1.RC1.el6.noarch 
 foreman-mysql2-1.5.0-0.1.RC1.el6.noarch 
 rubygem-hammer_cli_foreman-0.1.0-1.el6.noarch 
 foreman-selinux-1.5.0-0.1.RC1.el6.noarch 
 ruby193-rubygem-foreman_bootdisk-2.0.4-1.el6.noarch 
 ruby193-rubygem-foreman_setup-2.0.2-5.el6.noarch 

 foreman ~ # hammer --version 
 hammer (0.1.0) 
  * hammer_cli_foreman (0.1.0) 


 This seems to me like a bug in "hammer os add-config-template" command. 

 Can you check it please? 

 Thank you 

 PetrR

Back