Bug 746241 - UEPConnection.updateConsumer will not allow passing [] for facts, installed_products, or guest_uuids
UEPConnection.updateConsumer will not allow passing [] for facts, installed_p...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-rhsm (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Michael Stead
IDM QE LIST
:
Depends On:
Blocks: rhsm-rhel62 748554
  Show dependency treegraph
 
Reported: 2011-10-14 09:52 EDT by Michael Stead
Modified: 2013-01-10 05:56 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 12:26:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
rhsmcertd restart log (7.29 KB, text/plain)
2011-10-17 14:58 EDT, J.C. Molet
no flags Details

  None (edit)
Description Michael Stead 2011-10-14 09:52:28 EDT
Description of problem:
UEPConnection.updateConsumer(...) will not pass [] to the update request for either of facts, installed_products, or guest_uuids. If either are [], it is not added as a parameter of the POST request.

There are a couple of side effects here:

1) rhsmcertd - If an update occurs and there are no products installed (last update had > 1 products), an exception will be thrown.

2) virt-who - If virt-who attempts to update a host's guests, but there are none, an exception is thrown.



Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:

RHSMCERTD
----------
1. Add a product cert to /etc/pki/product
2. sudo service rhsmcertd restart
3. Remove all products from /etc/pki/product
4. sudo service rhsmcertd restart
5. Check /var/log/rhsm/rhsm.log for error.

2011-10-14 09:38:36,676 [ERROR]  @certmgr.py:131 - Error while updating certificates using daemon
2011-10-14 09:38:36,677 [ERROR]  @certmgr.py:133 - Error updating system data, see /var/log/rhsm/rhsm.log for more details.
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 124, in <module>
    main(options)
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 103, in main
    updates = mgr.update(options.autoheal)
  File "/usr/share/rhsm/subscription_manager/certmgr.py", line 79, in update
    updates += lib.update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 62, in update
    return self._do_update()
  File "/usr/share/rhsm/subscription_manager/cache.py", line 58, in _do_update
    return mgr.update_check(self.uep, consumer_uuid)
  File "/usr/share/rhsm/subscription_manager/cache.py", line 166, in update_check
    raise Exception(_("Error updating system data, see /var/log/rhsm/rhsm.log "
Exception: Error updating system data, see /var/log/rhsm/rhsm.log for more details.


VIRT-WHO
1. Run virt-who on a host (registered with Candlepin) that has no guests.
2. An exception should occur.
  

Expected results:
1) Should be able to pass [] as any parameter for updateConsumer.

i.e: connection.updateConsumer(uuid, guest_uuids=[])

2) The above side effects should not occur (no exceptions).

Additional info:
Comment 2 Michael Stead 2011-10-14 13:22:27 EDT
Fixed in:

RHEL6.2 - 15c6c49f87e91e527bc8de05e43bccc6d59cd2da
master - cc98b97ae0bcd5f2e7c09906b0ea56e67266014b
Comment 3 J.C. Molet 2011-10-17 14:58:27 EDT
Created attachment 528627 [details]
rhsmcertd restart log

Testing RHSMCERTD case:


[root@jmolet-vm0 product]# subscription-manager register --user testuser1 --pass password --org admin
The system has been registered with id: beade878-d357-4c9b-b715-4f7ee50d4dec 
[root@jmolet-vm0 product]# ls
100000000000008_.pem
[root@jmolet-vm0 product]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Awesome OS for x86_64/s390x Bits
Version:            	3.11                     
Arch:               	x86_64,s390x             
Status:             	Not Subscribed           
Starts:             	                         
Expires:            	                         

[root@jmolet-vm0 product]# service rhsmcertd restart
Stopping rhsmcertd                                         [  OK  ]
Starting rhsmcertd 240 1440                                [  OK  ]
[root@jmolet-vm0 product]# pwd && ls
/etc/pki/product
100000000000008_.pem
[root@jmolet-vm0 product]# rm 100000000000008_.pem 
rm: remove regular file `100000000000008_.pem'? y
[root@jmolet-vm0 product]# service rhsmcertd restart
Stopping rhsmcertd                                         [  OK  ]
Starting rhsmcertd 240 1440                                [  OK  ]
[root@jmolet-vm0 product]# rhsm-version
subscription-manager-0.96.15-1.git.2.6c0ad28.el6.x86_64
subscription-manager-gnome-0.96.15-1.git.2.6c0ad28.el6.x86_64
python-rhsm-0.96.13-1.git.1.15c6c49.el6.noarch
subscription-manager-firstboot-0.96.15-1.git.2.6c0ad28.el6.x86_64


No errors fine, and the system passed a blank array successfully (see attached log).
Comment 6 John Sefler 2011-11-01 17:33:21 EDT
Verifying virt-who case...

candlepin version...
[root@jsefler-onprem-62candlepin candlepin]# git show | egrep "commit|Date"
commit 7cb7dbe8d5e2892dcbcbf3d77a61541ca221c18f
Date:   Fri Oct 28 17:02:41 2011 -0400
    Automatic commit of package [candlepin] release [0.4.25-1].

virt-who version installed...
[root@hp-dl580g5-01 ~]# rpm -q virt-who
virt-who-0.3-3.el6.noarch


[root@hp-dl580g5-01 ~]# subscription-manager facts --list | grep is_guest
virt.is_guest: False
[root@hp-dl580g5-01 ~]# service libvirtd start
Starting libvirtd daemon: [  OK  ]
[root@hp-dl580g5-01 ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: 09378ce2-479e-410e-9c09-16dda78483f8 
[root@hp-dl580g5-01 ~]# 
[root@hp-dl580g5-01 ~]# virsh list
 Id Name                 State
----------------------------------

[root@hp-dl580g5-01 ~]# echo "" > /var/log/rhsm/rhsm.log 
[root@hp-dl580g5-01 ~]# virt-who -d
Sending update to updateConsumer: []
[root@hp-dl580g5-01 ~]# cat /var/log/rhsm/rhsm.log 

2011-11-01 16:17:59,981 [DEBUG]  @subscriptionmanager.py:72 - Sending update to updateConsumer: []
[root@hp-dl580g5-01 ~]# 


^^^ Verified that virt-who sent updateConsumer with no guests to candlepin and no traceback was encountered in rhsm.log


[root@hp-dl580g5-01 ~]# curl -k -u testuser1:password https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/consumers/09378ce2-479e-410e-9c09-16dda78483f8/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     18      0 --:--:-- --:--:-- --:--:--    43
[]
[root@hp-dl580g5-01 ~]# 

^^^ And as expected... the consumer has no virt guests known to candlepin api.
Comment 7 John Sefler 2011-11-01 17:34:31 EDT
moving to VERIFIED based on testcase results in comment 3 and comment 6
Comment 8 John Sefler 2011-11-02 10:30:00 EDT
(In reply to comment #6)

> [root@hp-dl580g5-01 ~]# curl -k -u testuser1:password
> https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/consumers/09378ce2-479e-410e-9c09-16dda78483f8/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     18      0 --:--:-- --:--:-- --:--:--    43
> []
> [root@hp-dl580g5-01 ~]# 
> 
> ^^^ And as expected... the consumer has no virt guests known to candlepin api.

^^ Disregard this assertion.  The candlepin API call to /consumers/09378ce2-479e-410e-9c09-16dda78483f8/guests is supposed to return the REGISTERED GUESTS and not just the GUESTS.  This was my misunderstanding of the candlepin API.
Comment 9 errata-xmlrpc 2011-12-06 12:26:20 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1696.html

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