Bug #5426
closed"hammer os add-config-template" not working
Description
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:
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" }
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
Files
Updated by Tomáš Strachota almost 11 years ago
- Translation missing: en.field_release deleted (
4)
Updated by Petr Ruzicka over 10 years ago
Hello.
I tried to check this issue with hammer 1.1, but still no luck. I hope the "id" parameter means "operating system id" in the hammer command ("hammer os add-config-template --help" - doesn't say much about it).
- hammer --version
hammer (0.1.1) * hammer_cli_foreman (0.1.1)
- rpm -qa | grep hammer
rubygem-hammer_cli_foreman-0.1.1-1.201405271211git2b64eb4.el6.noarch
rubygem-hammer_cli-0.1.1-1.201405271206git41f59a5.el6.noarch
- hammer --debug os add-config-template --id 3 --config-template-id 9
[ INFO 2014-05-28 10:04:49 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-05-28 10:04:49 Init] Running at ruby 1.8.7-p352
[ INFO 2014-05-28 10:04:49 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-05-28 10:04:49 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2014-05-28 10:04:49 Connection] Registered: foreman
[DEBUG 2014-05-28 10:04:49 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[ INFO 2014-05-28 10:04:49 API] GET /apidoc/apipie_checksum
[DEBUG 2014-05-28 10:04:49 API] Params: {}
[DEBUG 2014-05-28 10:04:49 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-05-28 10:04:49 API] Response {
"checksum" => "0000c2df84e796e8954351ff23f0f367"
}
[ INFO 2014-05-28 10:04:51 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[DEBUG 2014-05-28 10:04:51 Init] Using locale 'en'
[DEBUG 2014-05-28 10:04:51 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/locale'
[DEBUG 2014-05-28 10:04:51 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/locale'
[ INFO 2014-05-28 10:04:51 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2014-05-28 10:04:51 HammerCLIForeman::OperatingSystem] Called with options: {}
[ INFO 2014-05-28 10:04:51 HammerCLIForeman::OperatingSystem::OperatingSystemAddConfigTemplateCommand] Called with options: {"option_config_template_id"=>"9", "option_id"=>"3"}
[ INFO 2014-05-28 10:04:51 API] GET /apidoc/apipie_checksum
[DEBUG 2014-05-28 10:04:51 API] Params: {}
[DEBUG 2014-05-28 10:04:51 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-05-28 10:04:51 API] Response {
"checksum" => "0000c2df84e796e8954351ff23f0f367"
}
[ INFO 2014-05-28 10:04:51 API] GET /api/operatingsystems/3
[DEBUG 2014-05-28 10:04:51 API] Params: {}
[DEBUG 2014-05-28 10:04:51 API] Headers: {
:params => {}
}
[DEBUG 2014-05-28 10:04:51 API] Response {
"config_templates" => [
[0] {
"template_kind_id" => 1,
"name" => "FreeBSD (mfsBSD) PXELinux",
"id" => 9,
"template_kind_name" => "PXELinux"
}
],
"fullname" => "test 1.1",
"parameters" => [],
"updated_at" => "2014-05-28T07:58:49Z",
"name" => "test",
"architectures" => [
[0] {
"name" => "x86_64",
"id" => 1
},
[1] {
"name" => "i386",
"id" => 2
}
],
"minor" => "1",
"description" => "1",
"id" => 3,
"images" => [],
"release_name" => "",
"media" => [],
"family" => nil,
"os_default_templates" => [],
"ptables" => [],
"created_at" => "2014-05-28T07:58:49Z",
"major" => "1"
}
[ INFO 2014-05-28 10:04:51 API] GET /apidoc/apipie_checksum
[DEBUG 2014-05-28 10:04:51 API] Params: {}
[DEBUG 2014-05-28 10:04:51 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-05-28 10:04:52 API] Response {
"checksum" => "0000c2df84e796e8954351ff23f0f367"
}
[ INFO 2014-05-28 10:04:52 API] PUT /api/operatingsystems/3
[DEBUG 2014-05-28 10:04:52 API] Params: {
"operatingsystem" => {
"config_template_ids" => [
[0] "9"
]
}
}
[DEBUG 2014-05-28 10:04:52 API] Headers: {}
[DEBUG 2014-05-28 10:04:52 API] Response {
"config_templates" => [
[0] {
"template_kind_id" => 1,
"name" => "FreeBSD (mfsBSD) PXELinux",
"id" => 9,
"template_kind_name" => "PXELinux"
}
],
"fullname" => "test 1.1",
"parameters" => [],
"updated_at" => "2014-05-28T07:58:49Z",
"name" => "test",
"architectures" => [
[0] {
"name" => "x86_64",
"id" => 1
},
[1] {
"name" => "i386",
"id" => 2
}
],
"minor" => "1",
"description" => "1",
"id" => 3,
"images" => [],
"release_name" => "",
"media" => [],
"family" => nil,
"os_default_templates" => [],
"ptables" => [],
"created_at" => "2014-05-28T07:58:49Z",
"major" => "1"
}
Updated by Petr Ruzicka over 10 years ago
Hello.
I installed fresh Foreman 1.5.1 (including hammer 1.1) and the problem still persist:
foreman ~ # rpm -qa | egrep 'foreman|hammer'
foreman-release-1.5.1-1.el6.noarch
ruby193-rubygem-foreman_discovery-1.3.0-1.el6.noarch
foreman-console-1.5.1-1.el6.noarch
rubygem-foreman_api-0.1.11-1.el6.noarch
foreman-installer-1.5.1-1.el6.noarch
rubygem-hammer_cli_foreman-0.1.1-1.el6.noarch
foreman-selinux-1.5.1-1.el6.noarch
foreman-mysql2-1.5.1-1.el6.noarch
ruby193-rubygem-foreman_bootdisk-2.0.8-1.el6.noarch
ruby193-rubygem-foreman_setup-2.0.3-1.el6.noarch
foreman-compute-1.5.1-1.el6.noarch
rubygem-hammer_cli-0.1.1-1.el6.noarch
foreman-proxy-1.5.1-1.el6.noarch
foreman-1.5.1-1.el6.noarch
ruby193-rubygem-foreman_templates-1.4.0-2.el6.noarch
foreman ~ # hammer --debug os add-config-template --id $OPERATINGSYSTEM_ID --config-template-id $CONFIGTEMPLATE_ID_PXELINUX
[ INFO 2014-06-19 08:39:02 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-06-19 08:39:02 Init] Running at ruby 1.8.7-p352
[ INFO 2014-06-19 08:39:02 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-06-19 08:39:02 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2014-06-19 08:39:02 Connection] Registered: foreman
[DEBUG 2014-06-19 08:39:02 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[ INFO 2014-06-19 08:39:02 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-19 08:39:02 API] Params: {}
[DEBUG 2014-06-19 08:39:02 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-19 08:39:02 API] Response {
"checksum" => "b66a49c0707ea07c0ca6d88b884b08cd"
}
[ INFO 2014-06-19 08:39:04 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[DEBUG 2014-06-19 08:39:04 Init] Using locale 'en'
[DEBUG 2014-06-19 08:39:04 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/locale'
[DEBUG 2014-06-19 08:39:04 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/locale'
[ INFO 2014-06-19 08:39:04 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2014-06-19 08:39:04 HammerCLIForeman::OperatingSystem] Called with options: {}
[ INFO 2014-06-19 08:39:04 HammerCLIForeman::OperatingSystem::OperatingSystemAddConfigTemplateCommand] Called with options: {"option_config_template_id"=>"39", "option_id"=>"1"}
[ INFO 2014-06-19 08:39:04 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-19 08:39:04 API] Params: {}
[DEBUG 2014-06-19 08:39:04 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-19 08:39:04 API] Response {
"checksum" => "b66a49c0707ea07c0ca6d88b884b08cd"
}
[ INFO 2014-06-19 08:39:04 API] GET /api/operatingsystems/1
[DEBUG 2014-06-19 08:39:04 API] Params: {}
[DEBUG 2014-06-19 08:39:04 API] Headers: {
:params => {}
}
[DEBUG 2014-06-19 08:39:04 API] Response {
"minor" => "5",
"major" => "6",
"fullname" => "CentOS 6.5",
"id" => 1,
"family" => "Redhat",
"images" => [],
"ptables" => [
[0] {
"id" => 11,
"name" => "My_CentOS_partition_table"
}
],
"name" => "CentOS",
"description" => nil,
"architectures" => [
[0] {
"id" => 1,
"name" => "x86_64"
}
],
"updated_at" => "2014-06-19T06:08:34Z",
"release_name" => nil,
"os_default_templates" => [],
"config_templates" => [
[0] {
"id" => 38,
"template_kind_id" => 4,
"name" => "My_CentOS_Kickstart_Default",
"template_kind_name" => "provision"
},
[1] {
"id" => 39,
"template_kind_id" => 1,
"name" => "My_CentOS_Kickstart_default_PXElinux",
"template_kind_name" => "PXELinux"
}
],
"created_at" => "2014-06-19T06:08:34Z",
"media" => [
[0] {
"id" => 7,
"name" => "My_CentOS_mirror"
}
],
"parameters" => []
}
[ INFO 2014-06-19 08:39:04 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-19 08:39:04 API] Params: {}
[DEBUG 2014-06-19 08:39:04 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-19 08:39:05 API] Response {
"checksum" => "b66a49c0707ea07c0ca6d88b884b08cd"
}
[ INFO 2014-06-19 08:39:05 API] PUT /api/operatingsystems/1
[DEBUG 2014-06-19 08:39:05 API] Params: {
"operatingsystem" => {
"config_template_ids" => [
[0] "38",
[1] "39"
]
}
}
[DEBUG 2014-06-19 08:39:05 API] Headers: {}
[DEBUG 2014-06-19 08:39:05 API] Response {
"minor" => "5",
"major" => "6",
"fullname" => "CentOS 6.5",
"id" => 1,
"family" => "Redhat",
"images" => [],
"ptables" => [
[0] {
"id" => 11,
"name" => "My_CentOS_partition_table"
}
],
"name" => "CentOS",
"description" => nil,
"architectures" => [
[0] {
"id" => 1,
"name" => "x86_64"
}
],
"updated_at" => "2014-06-19T06:08:34Z",
"release_name" => nil,
"os_default_templates" => [],
"config_templates" => [
[0] {
"id" => 38,
"template_kind_id" => 4,
"name" => "My_CentOS_Kickstart_Default",
"template_kind_name" => "provision"
},
[1] {
"id" => 39,
"template_kind_id" => 1,
"name" => "My_CentOS_Kickstart_default_PXElinux",
"template_kind_name" => "PXELinux"
}
],
"created_at" => "2014-06-19T06:08:34Z",
"media" => [
[0] {
"id" => 7,
"name" => "My_CentOS_mirror"
}
],
"parameters" => []
}
Let me know if you need additional information.
Regards
PetrR
Updated by Petr Ruzicka about 10 years ago
Hello.
I tried to reproduce this bug and I can still reproduce it in
- hammer --version
hammer (0.1.3) * hammer_cli_foreman (0.1.3)
I'm using:
foreman-1.7.1-1.el6.noarch
foreman-cli-1.7.1-1.el6.noarch
Is this going to be fixed one day?
Regards
PetrR
Updated by Tomáš Strachota over 7 years ago
- Status changed from New to Closed
I tested the behavior with hammer-cli-foreman 0.11.0 and the foreman 1.15 and it seems to be fixed in that version:
> hammer os info --id 5 Id: 5 Title: RHEL 7 Release name: Family: Redhat Name: RHEL Major version: 7 Minor version: Partition tables: Default templates: Kickstart default (provision) Architectures: Installation media: Templates: Kickstart default (provision) Kickstart default finish (finish) Parameters: > hammer os add-config-template --id 5 --config-template 'Kickstart default PXEGrub' The configuration template has been associated > hammer os info --id 5 Id: 5 Title: RHEL 7 Release name: Family: Redhat Name: RHEL Major version: 7 Minor version: Partition tables: Default templates: Kickstart default (provision) Architectures: Installation media: Templates: Kickstart default (provision) Kickstart default finish (finish) Kickstart default PXEGrub (PXEGrub) Parameters: > hammer os remove-config-template --id 5 --config-template 'Kickstart default PXEGrub' The configuration template has been disassociated > hammer os info --id 5 Id: 5 Title: RHEL 7 Release name: Family: Redhat Name: RHEL Major version: 7 Minor version: Partition tables: Default templates: Kickstart default (provision) Architectures: Installation media: Templates: Kickstart default (provision) Kickstart default finish (finish) Parameters:
I'm closing the issue now. Feel free to re-open it if the problem persists in that version at your setup.