Bug 1136081

Summary: traceback when registering a content host
Product: Red Hat Satellite Reporter: Tomas Lestach <tlestach>
Component: APIAssignee: Christine Fouant <cfouant>
Status: CLOSED CURRENTRELEASE QA Contact: sthirugn <sthirugn>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.4CC: bbuckingham, bkearney, cwelton, dlobatog, ggainey, mmccune, sthirugn, tlestach
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/10536
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 16:05:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
relevant part of /var/log/foreman/production.log
none
production.log using subscription-manager
none
production.log using curl command none

Description Tomas Lestach 2014-09-01 15:35:28 UTC
Created attachment 933474 [details]
relevant part of /var/log/foreman/production.log

Description of problem:
There's a ugly traceback in /var/log/foreman/production.log when registering a content host

Version-Release number of selected component (if applicable):
Satellite-6.0.4-RHEL-6-20140829.0-Satellite-x86_64

How reproducible:
always

Steps to Reproduce:
1. Call:
$ curl -s -H "Content-Type:application/json" -H "Accept:application/json,version=2" -k -u admin:changeme -X POST -d'{"name":"mysystem", "facts":{"fact1":1}, "type":"system", "organization_id":1}' https://$(hostname)/katello/api/systems 


Actual results:
1.) command output look good and it looks like the content host was created:
{"id":29,"uuid":"f8967d2f-32c2-4808-9325-69e7112e24fa","name":"mysystem","description":"Initial Registration Params","location":"None","content_view":{"id":1,"name":"Default Organization View","label":"Default_Organization_View","description":null,"organization_id":1,"default":true,"created_at":"2014-09-01T10:26:12Z","updated_at":"2014-09-01T10:26:12Z","composite":null,"next_version":1,"organization":"Default_Organization","environments":["Library"],"versions":[1],"versions_details":[{"version":1,"published":"2014-09-01 10:26:12 UTC","environments":["Library"]}]},"content_view_id":1,"distribution":" ","katello_agent_installed":false,"content_overrides":[],"entitlementStatus":"valid","autoheal":true,"href":"/consumers/f8967d2f-32c2-4808-9325-69e7112e24fa","release":null,"checkin_time":null,"created":"2014-09-01T15:27:30.452+0000","installedProducts":[],"service_level":"","release_ver":null,"permissions":{"editable":true},"products":[],"host":null,"hostCollections":[],"customInfo":[],"environment":{"id":1,"name":"Library","label":"Library","description":null,"organization":{"name":"Default_Organization","label":"Default_Organization"},"created_at":"2014-09-01T10:26:11Z","updated_at":"2014-09-01T10:26:11Z","library":true,"prior":null,"permissions":{"view_lifecycle_environments":true,"edit_lifecycle_environments":true,"destroy_lifecycle_environments":true,"promote_or_remove_content_views_to_environments":true}},"activation_keys":[]}

2.) checking /var/log/foreman/production.log there's a pulp error (full traceback attached)
[ERROR 2014-09-01 11:27:31 pulp_rest  #13841] RestClient.get "https://hp-sl2x170zg6-01.rhts.eng.bos.redhat.com/pulp/api/v2/consumers/f8967d2f-32c2-4808-9325-69e7112e24fa/profiles/rpm//", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Authorization"=>"OAuth oauth_consumer_key=\"katello\", oauth_nonce=\"9YRutAQTth4Sakzi4MGce9C19aHScoPtFF6xCtWFxE\", oauth_signature=\"YaczXdRkP9DHTvxADzbnr9qdzu8%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1409585251\", oauth_version=\"1.0\"", "accept"=>"application/json", "content_type"=>"application/json", "pulp-user"=>"admin-bc8ca035"
 | \n# => 404 NotFound | application/json 714 bytes


Expected results:
no traceback

Comment 4 Christine Fouant 2015-05-18 16:31:37 UTC
Created redmine issue http://projects.theforeman.org/issues/10536 from this bug

Comment 5 Bryan Kearney 2015-05-18 18:03:18 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10536 has been closed
-------------
Christine Fouant
Applied in changeset commit:katello|b5b37d33cb9aeae12f2527d77f815667f282f941.

Comment 8 sthirugn@redhat.com 2015-05-21 19:21:21 UTC
Failed in Sat 6.1 GA Snap 5.

I dont see any traceback while registering a content host using:
# subscription-manager register --org="Default_Organization" --activationkey=rhel7partialak

But when I use the api as mentioned in the bug description, I got the same error as mentioned in the bug description:

# curl -s -H "Content-Type:application/json" -H "Accept:application/json,version=2" -k -u admin:changeme -X POST -d'{"name":"mysystem", "facts":{"fact1":1}, "type":"system", "organization_id":1}' https://$sat6host/katello/api/systems

**curl command ran without any errors**

But I saw the error in

==> /var/log/foreman/production.log <==
[ERROR 2015-05-21 15:16:27 pulp_rest  #5206] RestClient.get "https://ibm-x3250m4-05.lab.eng.rdu2.redhat.com/pulp/api/v2/consumers/39ebef93-b66f-452e-994d-c8d09834043a/profiles/rpm//", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Authorization"=>"OAuth oauth_consumer_key=\"katello\", oauth_nonce=\"04UhCDnEsCLaEU07LjJFpuPA8SlfFoyhRLodllg0Mg\", oauth_signature=\"KFo52K5U%2FBt4B04rABLTiQT1WfI%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1432235787\", oauth_version=\"1.0\"", "accept"=>"application/json", "content_type"=>"application/json", "pulp-user"=>"admin-2201e0e4"
 | \n# => 404 NotFound | application/json 714 bytes
 | 
2015-05-21 15:16:27 [I] Failed to find profile for 39ebef93-b66f-452e-994d-c8d09834043a: 404 Resource Not Found: {"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): profile_id={'content_type': u'rpm', 'consumer_id': u'39ebef93-b66f-452e-994d-c8d09834043a'}", "_href": "/pulp/api/v2/consumers/39ebef93-b66f-452e-994d-c8d09834043a/profiles/rpm/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"profile_id": {"content_type": "rpm", "consumer_id": "39ebef93-b66f-452e-994d-c8d09834043a"}}}, "description": "Missing resource(s): profile_id={'content_type': u'rpm', 'consumer_id': u'39ebef93-b66f-452e-994d-c8d09834043a'}", "sub_errors": []}, "traceback": null, "resources": {"profile_id": {"content_type": "rpm", "consumer_id": "39ebef93-b66f-452e-994d-c8d09834043a"}}}}

Foreman-debug attached.

Comment 10 Christine Fouant 2015-06-18 18:17:50 UTC
This fix will require runcible gem to be updated >= 1.3.5

https://github.com/Katello/runcible/pull/144

Comment 12 Bryan Kearney 2015-06-26 14:32:52 UTC
Delivered in Snap10

Comment 13 sthirugn@redhat.com 2015-07-07 20:55:39 UTC
Verified in Sat 6.1 GA Snap 11.  I dont see `RestClient.get` error anymore as mentioned in Comment 8.

I verified both using subscription manager and the curl command as mentioned in Comment 8.  See verification logs attached.

Comment 14 sthirugn@redhat.com 2015-07-07 20:56:36 UTC
Created attachment 1049569 [details]
production.log using subscription-manager

Comment 15 sthirugn@redhat.com 2015-07-07 20:56:56 UTC
Created attachment 1049570 [details]
production.log using curl command

Comment 16 Bryan Kearney 2015-08-12 16:05:19 UTC
This bug was fixed in Satellite 6.1.1 which was delivered on 12 August, 2015.