Bug 750659 - candlepin api /consumers/<consumerid>/guests is returning []
Summary: candlepin api /consumers/<consumerid>/guests is returning []
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Bryan Kearney
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-11-01 21:46 UTC by John Sefler
Modified: 2015-05-14 15:22 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-11-02 14:25:51 UTC
Embargoed:


Attachments (Terms of Use)

Description John Sefler 2011-11-01 21:46:09 UTC
Description of problem:
I expect the api /consumers/<consumerid>/guests to return a list of the consumer's guestIds, but it is not.  My test scenario is:
1. register a consumer
2. update the consumer by PUTting {"guestIds":["1","2","3"]}
3. GET the /consumers/<uuid>/guests

Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62candlepin candlepin]# git show | head -1
commit 7cb7dbe8d5e2892dcbcbf3d77a61541ca221c18f
[root@jsefler-onprem-62candlepin candlepin]# curl -k -u admin:admin  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/status
{"version":"0.4.25","result":true,"standalone":true,"release":"1"}[root@jsefler-onprem-62candlepin candlepin]# 


How reproducible:


Steps to Reproduce:
[root@hp-dl580g5-01 ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: 46efe36f-25c8-4b1a-a3e6-e98fd80153bc 

[root@hp-dl580g5-01 ~]# curl --insecure --user testuser1:password --request PUT --data '{"guestIds":["1","2","3"]}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/consumers/46efe36f-25c8-4b1a-a3e6-e98fd80153bc

[root@hp-dl580g5-01 ~]# curl -k -u testuser1:password https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/consumers/46efe36f-25c8-4b1a-a3e6-e98fd80153bc/ | python -mjson.tool | grep guestId
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9213    0  9213    0     0  51646      0 --:--:-- --:--:-- --:--:-- 80113
    "guestIds": [
            "guestId": "3", 
            "guestId": "2", 
            "guestId": "1", 

[root@hp-dl580g5-01 ~]# curl -k -u testuser1:password https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/consumers/46efe36f-25c8-4b1a-a3e6-e98fd80153bc/guests | python -mjson.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     2    0     2    0     0     11      0 --:--:-- --:--:-- --:--:--    21
[]
[root@hp-dl580g5-01 ~]# 

  
^^ I EXPECTED THAT LAST CALL TO /consumers/46efe36f-25c8-4b1a-a3e6-e98fd80153bc/guests TO RETURN A LIST OF THREE guestIds, BUT IT WAS EMPTY.


Additional info:

Comment 1 Devan Goodwin 2011-11-02 14:25:51 UTC
This is confusion around the concept of a guestId, which is a unique identifier from whatever virt solution you are using, and actual registered guest consumers.

Hosts report guestIds they have running, guests report their guestId in their virt.uuid fact.

GET /consumers/UUID/guests returns actual guest consumers, so if the above guestIds do not match up (no consumer reporting that guestId is registered yet, or another host has more recently reported that guestId as running on it), then the results from this API call will be empty.

So to test this API you would need an additional consumer registered with a virt.uuid fact matching one of the guestIds you set for the host.


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