Bug #6635
closedCould not create content host with a new content view
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1114046
Description of problem:
When creating a content host by passing a content view hammer fails with an exception and the content host is not created.
- hammer --version
hammer (0.1.1) * hammer_cli_foreman (0.1.1) * hammer_cli_katello (0.0.4)
How reproducible:
Aways
Steps to Reproduce:
1. LANG=en_US hammer -v -u admin -p changeme --output csv content-view create --organization-id=<org_id> --name='RJZLxjycfV'
2. LANG=en_US hammer -d -v -u admin -p changeme --output csv content-host create --name='NLqvcxFvwhNGzXO' --content-view-id=<id_created_cv> --organization-id=<org_id> --environment-id=<env_id> --description='QkHqyfsBeahqwpGzLIeo'
Actual results:
The command is raising an exception and the content host is not being created
Expected results:
Content host should be created
- LANG=en_US hammer -d -v -u admin -p changeme --output csv content-host create --name='NLqvcxFvwhNGzXO' --content-view-id='49' --organization-id='42' --environment-id='44' --description='QkHqyfsBeahqwpGzLIeo'
[ INFO 2014-06-27 10:16:05 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-06-27 10:16:05 Init] Running at ruby 1.8.7-p352
[ INFO 2014-06-27 10:16:05 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-06-27 10:16:05 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2014-06-27 10:16:05 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2014-06-27 10:16:05 Connection] Registered: foreman
[DEBUG 2014-06-27 10:16:05 API] Global headers: {
"Accept-Language" => "en",
:accept => "application/json;version=2",
:content_type => "application/json"
}
[ INFO 2014-06-27 10:16:05 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-27 10:16:05 API] Params: {}
[DEBUG 2014-06-27 10:16:05 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-27 10:16:05 API] Response {
"checksum" => "3b83bcbfdca9959f0655450f22b9ebff"
}
[ INFO 2014-06-27 10:16:06 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[ INFO 2014-06-27 10:16:06 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2014-06-27 10:16:06 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2014-06-27 10:16:07 Modules] Extension module hammer_cli_katello (0.0.4) loaded
[DEBUG 2014-06-27 10:16:07 Init] Using locale 'en'
[DEBUG 2014-06-27 10:16:07 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-27 10:16:07 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'
[DEBUG 2014-06-27 10:16:07 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.4/locale'
[ INFO 2014-06-27 10:16:07 HammerCLI::MainCommand] Called with options: {"option_debug"=>true, "option_output"=>"csv", "option_verbose"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2014-06-27 10:16:07 HammerCLIKatello::ContentHostCommand] Called with options: {}
[ INFO 2014-06-27 10:16:07 HammerCLIKatello::ContentHostCommand::CreateCommand] Called with options: {"option_environment_id"=>"44", "option_description"=>"QkHqyfsBeahqwpGzLIeo", "option_organization_id"=>"42", "option_content_view_id"=>"49", "option_name"=>"NLqvcxFvwhNGzXO"}
[ INFO 2014-06-27 10:16:07 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-27 10:16:07 API] Params: {}
[DEBUG 2014-06-27 10:16:07 API] Headers: {
:accept => "application/json",
:params => {}
}
[DEBUG 2014-06-27 10:16:07 API] Response {
"checksum" => "3b83bcbfdca9959f0655450f22b9ebff"
}
[ INFO 2014-06-27 10:16:07 API] POST /katello/api/environments/44/systems
[DEBUG 2014-06-27 10:16:07 API] Params: {
"facts" => {
"uname.machine" => "unknown"
},
"name" => "NLqvcxFvwhNGzXO",
"content_view_id" => "49",
"organization_id" => "42",
"type" => "system",
"description" => "QkHqyfsBeahqwpGzLIeo"
}
[DEBUG 2014-06-27 10:16:07 API] Headers: {}
[ERROR 2014-06-27 10:16:07 API] 500 Internal Server Error {
"errors" => [
[0] "undefined method `cp_id' for nil:NilClass"
],
"displayMessage" => "undefined method `cp_id' for nil:NilClass"
}
[ERROR 2014-06-27 10:16:07 Exception] undefined method `cp_id' for nil:NilClass
Could not create content host:
undefined method `cp_id' for nil:NilClass
[ERROR 2014-06-27 10:16:07 Exception]
RestClient::InternalServerError (500 Internal Server Error):
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/resource.rb:71:in `post'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:195:in `send'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:195:in `http_call'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:151:in `call'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.8/lib/apipie_bindings/resource.rb:14:in `call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:154:in `send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:33: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