Created attachment 902943 [details] ISE error in production.log while creating content-host via hammer Description of problem: [root@dhcp201-193 yum.repos.d]# hammer content-host create --name test.katellolabs.org --organization-id 1 --environment Library/cv1 Could not create content host: undefined method `get_content_view_environment_by_cp_id' for #<Katello::Api::V2::SystemsController:0x0000000e81ac28> Version-Release number of selected component (if applicable): sat6 beta snap8 (Satellite-6.0.3-RHEL-6-20140604.0). How reproducible: always Steps to Reproduce: 1. create content-host via cli [root@dhcp201-193 yum.repos.d]# hammer content-host create --name test.katellolabs.org --organization-id 1 --environment Library/cv1 Could not create content host: undefined method `get_content_view_environment_by_cp_id' for #<Katello::Api::V2::SystemsController:0x0000000e81ac28> 2. 3. Actual results: Expected results: If parameters are in-correct then user should get proper error message otherwise user should be able to create content-host Additional info:
hammer with -d: ================== [root@dhcp201-193 yum.repos.d]# hammer -d content-host create --name test.katellolabs.org --organization-id 1 --environment Library/cv1 [ INFO 2014-06-06 14:26:34 Init] Initialization of Hammer CLI (0.1.1) has started... [DEBUG 2014-06-06 14:26:34 Init] Running at ruby 1.8.7-p352 [ INFO 2014-06-06 14:26:34 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded [ INFO 2014-06-06 14:26:34 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded [ INFO 2014-06-06 14:26:34 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded [DEBUG 2014-06-06 14:26:34 Connection] Registered: foreman [DEBUG 2014-06-06 14:26:34 API] Global headers: { "Accept-Language" => "en", :accept => "application/json;version=2", :content_type => "application/json" } [ INFO 2014-06-06 14:26:34 API] GET /apidoc/apipie_checksum [DEBUG 2014-06-06 14:26:34 API] Params: {} [DEBUG 2014-06-06 14:26:34 API] Headers: { :params => {}, :accept => "application/json" } [DEBUG 2014-06-06 14:26:34 API] Response { "checksum" => "9cf01def29f2e4e54dbd2be940759d3a" } [ INFO 2014-06-06 14:26:35 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed. [ INFO 2014-06-06 14:26:35 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created. [ INFO 2014-06-06 14:26:35 Modules] Extension module hammer_cli_katello (0.0.4) loaded [ INFO 2014-06-06 14:26:35 Modules] Extension module hammer_cli_foreman (0.1.1) loaded [DEBUG 2014-06-06 14:26:35 Init] Using locale 'en' [DEBUG 2014-06-06 14:26:35 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-06 14:26:35 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-06 14:26:35 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-06 14:26:36 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} [ INFO 2014-06-06 14:26:36 HammerCLIKatello::ContentHostCommand] Called with options: {} [ INFO 2014-06-06 14:26:36 HammerCLIKatello::ContentHostCommand::CreateCommand] Called with options: {"option_organization_id"=>"1", "option_name"=>"test.katellolabs.org", "option_environment_name"=>"Library/cv1"} [ INFO 2014-06-06 14:26:36 API] GET /apidoc/apipie_checksum [DEBUG 2014-06-06 14:26:36 API] Params: {} [DEBUG 2014-06-06 14:26:36 API] Headers: { :params => {}, :accept => "application/json" } [DEBUG 2014-06-06 14:26:36 API] Response { "checksum" => "9cf01def29f2e4e54dbd2be940759d3a" } [ INFO 2014-06-06 14:26:36 API] GET /api/environments [DEBUG 2014-06-06 14:26:36 API] Params: { "name" => "Library/cv1" } [DEBUG 2014-06-06 14:26:36 API] Headers: { :params => { "name" => "Library/cv1" } } [DEBUG 2014-06-06 14:26:36 API] Response { "page" => 1, "total" => 1, "sort" => { "by" => nil, "order" => nil }, "search" => nil, "per_page" => 20, "subtotal" => 1, "results" => [ [0] { "created_at" => "2014-06-06T03:35:58Z", "name" => "production", "updated_at" => "2014-06-06T03:35:58Z", "id" => 1 } ] } [ INFO 2014-06-06 14:26:36 API] GET /apidoc/apipie_checksum [DEBUG 2014-06-06 14:26:36 API] Params: {} [DEBUG 2014-06-06 14:26:36 API] Headers: { :params => {}, :accept => "application/json" } [DEBUG 2014-06-06 14:26:36 API] Response { "checksum" => "9cf01def29f2e4e54dbd2be940759d3a" } [ INFO 2014-06-06 14:26:36 API] POST /katello/api/environments/1/systems [DEBUG 2014-06-06 14:26:36 API] Params: { "facts" => { "uname.machine" => "unknown" }, "organization_id" => "1", "name" => "test.katellolabs.org", "type" => "system" } [DEBUG 2014-06-06 14:26:36 API] Headers: {} [ERROR 2014-06-06 14:26:36 API] 500 Internal Server Error { "errors" => [ [0] "undefined method `get_content_view_environment_by_cp_id' for #<Katello::Api::V2::SystemsController:0x0000000dd5d498>" ], "displayMessage" => "undefined method `get_content_view_environment_by_cp_id' for #<Katello::Api::V2::SystemsController:0x0000000dd5d498>" } [ERROR 2014-06-06 14:26:36 Exception] undefined method `get_content_view_environment_by_cp_id' for #<Katello::Api::V2::SystemsController:0x0000000dd5d498> Could not create content host: undefined method `get_content_view_environment_by_cp_id' for #<Katello::Api::V2::SystemsController:0x0000000dd5d498> [ERROR 2014-06-06 14:26:36 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 [root@dhcp201-193 yum.repos.d]#
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.
I'm going to fix the API bug ("undefined method `get_content_view_environment_by_cp_id'"). I'm assuming the --environment option should be fixed by https://bugzilla.redhat.com/show_bug.cgi?id=1107319 as I ran into the following problem: $ hammer content-host create --name test.katellolabs.org --organization-id 1 --environment Library/cv1 Could not create content host: Error: environment found more than once I was able to get --environment-id working though (which is how you can test this bug if --environment is still not working): $ hammer content-host create --name test.katellolabs.org --organization-id 1 --environment-id "1-3"
Created redmine issue http://projects.theforeman.org/issues/6146 from this bug
Moving to POST since upstream bug http://projects.theforeman.org/issues/6146 has been closed
May require this bug fixed to test as per initial bug report, that is with --environment option https://bugzilla.redhat.com/show_bug.cgi?id=1108779 but as suggested, testing with --environment-id may work.
Verified # hammer content-host create --name test.org --organization-id 1 Name: test.org ID: 9fc0eb11-3500-4f1a-ae6b-47cdaf7f505b Description: Initial Registration Params Location: None Lifecycle Environment: Library Content View: Default Organization View Entitlement Status: valid Release Version: Autoheal: true Content host created
This was delivered with 6.0.3, which is the Satellite 6 Beta.