Bug 1123971

Summary: hammer capsule content add-lifecycle-environment ActiveRecord::RecordNotFound
Product: Red Hat Satellite 6 Reporter: Andrew Schofield <andrew.schofield>
Component: HammerAssignee: Justin Sherrill <jsherril>
Status: CLOSED WORKSFORME QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: medium    
Version: UnspecifiedCC: andrew.schofield, bbuckingham, cwelton, kabbott, sthirugn, xdmoon
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: UnusedFlags: andrew.schofield: needinfo-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 18:03:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1115190    

Description Andrew Schofield 2014-07-28 18:34:22 UTC
Description of problem:

# hammer capsule content add-lifecycle-environment --id 1 --environment-id 3 
Could not add the lifecycle environment to the capsule:
  ActiveRecord::RecordNotFound


# hammer capsule list
---|---------------------------|---------------------------------------
ID | NAME                      | URL
---|---------------------------|---------------------------------------
1  | capsule                   | https://capsule:9090
---|---------------------------|---------------------------------------
[root@capsule repodata]# hammer capsule content available-lifecycle-environments --id 1
---|----------|--------------
ID | NAME     | ORGANIZATION
---|----------|--------------
3  | GPS Unix | MyOrg
1  | Library  | MyOrg
---|----------|--------------
[root@capsule repodata]# hammer capsule content add-lifecycle-environment --id 1 --environment-id 3
Could not add the lifecycle environment to the capsule:
  ActiveRecord::RecordNotFound

This is the backtrace from /root/.foreman/log/hammer.log
[ERROR 2014-07-28 14:30:24 API] 404 Resource Not Found
{
            "errors" => [
        [0] "ActiveRecord::RecordNotFound"
    ],
    "displayMessage" => "ActiveRecord::RecordNotFound"
}
[ERROR 2014-07-28 14:30:24 Exception] ActiveRecord::RecordNotFound
[ERROR 2014-07-28 14:30:24 Exception]

RestClient::ResourceNotFound (404 Resource Not Found):
    /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/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

Comment 1 RHEL Product and Program Management 2014-07-28 19:03:51 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 Justin Sherrill 2014-08-15 14:51:00 UTC
1.  can you upload a foreman-debug as well?  That would give us more information
2.  Is there a registered content host with the same exact name as the Capsule?  If they don't match exactly you will get a similar error.

Comment 5 Justin Sherrill 2014-08-21 18:23:00 UTC
Workaround:


Ensure that Capsule is registered as a content host (using subscription manager) and that the content host has the same name as the capsule.

For example, if the Capulse is named "capsule.example.com", the Content Host needs to be named "capsule.example.com"

Comment 6 Justin Sherrill 2014-10-14 18:03:23 UTC
closing due to lack of feedback if this is still occurring please provide the requested info and re-open