hammer -u admin -p changeme -d os set-default-template
–config-template-id 44 --id 1
[ INFO 2014-06-16 14:09:45 Init] Initialization of Hammer CLI (0.1.1) has
started…
[DEBUG 2014-06-16 14:09:45 Init] Running at ruby 1.8.7-p352
[ INFO 2014-06-16 14:09:45 Init] Configuration from the file
/etc/hammer/cli_config.yml has been loaded
[ INFO 2014-06-16 14:09:45 Init] Configuration from the file
/etc/hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2014-06-16 14:09:45 Connection] Registered: foreman
[DEBUG 2014-06-16 14:09:45 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[ INFO 2014-06-16 14:09:45 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-16 14:09:45 API] Params: {}
[DEBUG 2014-06-16 14:09:45 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-16 14:09:45 API] Response {
"checksum" => "539427be20f794ea247db15b46a9091c"
}
[ INFO 2014-06-16 14:09:46 Modules] Extension module hammer_cli_foreman
(0.1.1) loaded
[DEBUG 2014-06-16 14:09:46 Init] Using locale 'en'
[DEBUG 2014-06-16 14:09:46 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-16 14:09:46 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-16 14:09:46 HammerCLI::MainCommand] Called with options:
{"option_username"=>"admin", "option_password"=>"***", "option_debug"=>true}
[ INFO 2014-06-16 14:09:46 HammerCLIForeman::OperatingSystem] Called with
options: {}
[ INFO 2014-06-16 14:09:46
HammerCLIForeman::OperatingSystem::SetOsDefaultTemplate] Called with
options: {"option_id"=>"1", "option_config_template_id"=>"44"}
[ INFO 2014-06-16 14:09:46 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-16 14:09:46 API] Params: {}
[DEBUG 2014-06-16 14:09:46 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-16 14:09:46 API] Response {
"checksum" => "539427be20f794ea247db15b46a9091c"
}
[ INFO 2014-06-16 14:09:46 API] GET /api/config_templates/44
[DEBUG 2014-06-16 14:09:46 API] Params: {}
[DEBUG 2014-06-16 14:09:46 API] Headers: {
:params => {}
}
[DEBUG 2014-06-16 14:09:46 API] Response {
"template_kind_name" => "provision",
"template" => "<%#\nkind : provision\nname : Redhat
default Kickstart\noses :\n- CentOS 5\n- CentOS 6\n%>\nfoo",
"template_combinations" => [],
"audit_comment" => nil,
"id" => 44,
"operatingsystems" => [
[0] {
"id" => 1,
"fullname" => "CentOS 6.5",
"name" => "CentOS"
},
[1] {
"id" => 2,
"fullname" => "CentOS 5.10",
"name" => "CentOS"
}
],
"updated_at" => "2014-06-16T12:06:50Z",
"template_kind_id" => 4,
"os_default_templates" => [],
"created_at" => "2014-06-16T12:06:50Z",
"snippet" => false,
"name" => "Redhat default Kickstart"
}
[ INFO 2014-06-16 14:09:46 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-16 14:09:46 API] Params: {}
[DEBUG 2014-06-16 14:09:46 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-16 14:09:46 API] Response {
"checksum" => "539427be20f794ea247db15b46a9091c"
}
[ INFO 2014-06-16 14:09:46 API] GET
/api/operatingsystems/1/os_default_templates
[DEBUG 2014-06-16 14:09:46 API] Params: {}
[DEBUG 2014-06-16 14:09:46 API] Headers: {
:params => {}
}
[DEBUG 2014-06-16 14:09:46 API] Response #<String:0x7f4368cfa4b0
attr_accessor :args = {
:method => :get,
:headers => {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
},
:timeout => nil,
:oauth => nil,
:url =>
"https://localhost//api/operatingsystems/1/os_default_templates",
:user => "admin",
:password => "changeme"
},
attr_accessor :net_http_res = #<Net::HTTPOK:0x7f4368d004c8
@body_exist = true,
@read = true,
@socket = nil,
attr_reader :body = …String…,
attr_reader :code = "200",
attr_reader :header = {
"apipie-checksum" => [
[0] "539427be20f794ea247db15b46a9091c"
],
"x-rack-cache" => [
[0] "miss"
],
"transfer-encoding" => [
[0] "chunked"
],
"x-runtime" => [
[0] "0.130100"
],
"x-request-id" => [
[0] "26c5f9ae2e58802d892fc8de9541a9cc"
],
"content-type" => [
[0] "application/json; charset=utf-8"
],
"x-powered-by" => [
[0] "Phusion Passenger 4.0.18"
],
"foreman_version" => [
[0] "1.5.0"
],
"cache-control" => [
[0] "must-revalidate, private, max-age=0"
],
"etag" => [
[0] ""c592d730e00bf604c6a99fb07d05c8ca""
],
"foreman_api_version" => [
[0] "2"
],
"status" => [
[0] "200 OK"
],
"set-cookie" => [
[0] "_session_id=0b0f9293ebce3f551000e9b3e4606d05; path=/;
HttpOnly"
],
"server" => [
[0] "Apache/2.2.15 (CentOS)"
],
"date" => [
[0] "Mon, 16 Jun 2014 12:09:46 GMT"
],
"connection" => [
[0] "close"
],
"x-ua-compatible" => [
[0] "IE=Edge,chrome=1"
]
},
attr_reader :http_version = "1.1",
attr_reader :message = "OK"
>,
attr_reader :code = 200,
attr_reader :headers = {
:status => "200 OK",
:etag => ""c592d730e00bf604c6a99fb07d05c8ca"",
:content_type => "application/json; charset=utf-8",
:x_rack_cache => "miss",
:x_ua_compatible => "IE=Edge,chrome=1",
:set_cookie => [
[0] "_session_id=0b0f9293ebce3f551000e9b3e4606d05; path=/;
HttpOnly"
],
:server => "Apache/2.2.15 (CentOS)",
:x_request_id => "26c5f9ae2e58802d892fc8de9541a9cc",
:connection => "close",
:cache_control => "must-revalidate, private, max-age=0",
:date => "Mon, 16 Jun 2014 12:09:46 GMT",
:x_runtime => "0.130100",
:foreman_version => "1.5.0",
:transfer_encoding => "chunked",
:foreman_api_version => "2",
:x_powered_by => "Phusion Passenger 4.0.18",
:apipie_checksum => "539427be20f794ea247db15b46a9091c"
}
>
[ERROR 2014-06-16 14:09:46 Exception] Error: Received data of unknown format
Could not set the os default template:
Error: Received data of unknown format
[ERROR 2014-06-16 14:09:46 Exception]
RuntimeError (Received data of unknown format):
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:73:in
`collection_to_common_format'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/operating_system.rb:158:in
`template_exist?'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/operating_system.rb:187:in
execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/…/abstract.rb:22:in
`run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in
execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/…/abstract.rb:22:in
`run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in
execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/…/abstract.rb:22:in
run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:100
/usr/bin/hammer:19:in `load'
/usr/bin/hammer:19
···
Le lundi 16 juin 2014 10:59:33 UTC+2, Tomas Strachota a écrit :
>
> On 06/13/2014 03:19 PM, Alexandre Barth wrote:
> > Hello !
> > I can't set my os default templates using hammer cli 0.1.1 :
> > hammer -u admin -p changeme --version
> > hammer (0.1.1)
> > * hammer_cli_foreman (0.1.1)
> > hammer -u admin -p changeme --show-ids os info --id 1
> > Id: 1
> > Full name: CentOS 6.5
> > Release name:
> > Family: Redhat
> > Name: CentOS
> > Major version: 6
> > Minor version: 5
> > Partition tables:
> > Redhat_6_Disk30Go_Default5Go (id: 13)
> > Redhat_6_Disk50Go_Opt20Go (id: 14)
> > Redhat_6_Disk50Go_Var20Go (id: 15)
> > Default templates:
> > Architectures:
> > i386 (id: 2)
> > x86_64 (id: 1)
> > Installation media:
> > CentOS mirror (id: 7)
> > Templates:
> > Redhat default Kickstart (provision, id: 48)
> > Redhat default PXELinux (PXELinux, id: 42)
> > Redhat default finish (finish, id: 45)
> > Parameters:
> > hammer -u admin -p changeme os set-default-template --config-template-id
> > 48 --id 1
> > Could not set the os default template:
> > Error: Received data of unknown format
> > What am i doing wrong ?
> >
>
> Hello,
> can you please provide full debug log of the set-default-template
> command (hammer -d ...)?
> There's a chance that you're using some older version of foreman that
> latest hammer is incompatible with.
>
> Regards
> Tomas
>
>
>
>
>