Bug 750659 - candlepin api /consumers/<consumerid>/guests is returning []
candlepin api /consumers/<consumerid>/guests is returning []
Product: Candlepin
Classification: Community
Component: candlepin (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Bryan Kearney
John Sefler
Depends On:
Blocks: rhsm-rhel62
  Show dependency treegraph
Reported: 2011-11-01 17:46 EDT by John Sefler
Modified: 2015-05-14 11:22 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-11-02 10:25:51 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-11-01 17:46:09 EDT
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 10:25:51 EDT
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.