Bug 1105623 - hammer: 500 ISE when creating a content-host
Summary: hammer: 500 ISE when creating a content-host
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: David Davis
QA Contact: Tazim Kolhar
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-06 14:37 UTC by Sachin Ghai
Modified: 2019-09-26 18:13 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-02 14:05:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
ISE error in production.log while creating content-host via hammer (13.01 KB, text/x-log)
2014-06-06 14:37 UTC, Sachin Ghai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 6146 0 None None None 2016-04-22 15:03:42 UTC

Description Sachin Ghai 2014-06-06 14:37:52 UTC
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:

Comment 1 Sachin Ghai 2014-06-06 14:39:08 UTC
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]#

Comment 2 RHEL Program Management 2014-06-06 14:43:45 UTC
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.

Comment 4 David Davis 2014-06-10 17:56:11 UTC
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"

Comment 5 Bryan Kearney 2014-06-10 18:00:33 UTC
Created redmine issue http://projects.theforeman.org/issues/6146 from this bug

Comment 6 Bryan Kearney 2014-06-11 18:16:08 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6146 has been closed

Comment 9 Kedar Bidarkar 2014-06-13 11:56:40 UTC
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.

Comment 10 Tazim Kolhar 2014-06-16 09:51:58 UTC
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

Comment 11 Bryan Kearney 2014-07-02 14:05:09 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.


Note You need to log in before you can comment on or make changes to this bug.