Bug 1311884

Summary: Error in communication with subscription manager as retry_after is "NoneType"
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8CC: gxing, hsun, lmiksik, ovasik, rbalakri, sgao, shihliu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.16-5.el6.noarch Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 23:57:38 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
virt-who log none

Description Liushihui 2016-02-25 09:39:09 UTC
Description of problem:
When virt-who communicate with stage candlepin, if virt-who received 429, it will show "Error in communication with subscription manager" is cause by "TypeError: int() argument must be a string or a number, not 'NoneType'"

Version-Release number of selected component (if applicable):
virt-who-0.16-4.el6.noarch
subscription-manager-1.16.8-2.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Register system to stage candlepin
2.Configure virt-who monitor esx and hyperv as the following:
[root@sgi-xe500-01 ~]# cat /etc/virt-who.d/virt
[test-esx1]
type=esx
server=10.73.2.95
username=Administrator
password=Welcome1!
owner=ACME_Corporation
env=Library
hypervisor_id=hostname
[root@sgi-xe500-01 ~]# cat /etc/sysconfig/virt-who  | grep -v ^# | grep -v ^$
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=2
VIRTWHO_HYPERV=1
VIRTWHO_HYPERV_OWNER=ACME_Corporation
VIRTWHO_HYPERV_ENV=Library
VIRTWHO_HYPERV_SERVER=10.73.5.212
VIRTWHO_HYPERV_USERNAME=administrator
VIRTWHO_HYPERV_PASSWORD=Welcome1
3. Restart virt-who service and monitor virt-who's log
[root@sgi-xe500-01 ~]# service virt-who restart
[root@sgi-xe500-01 ~]# tail -f /var/log/rhsm/rhsm.log

Actual results:
When virt-who received 429 code, it will show error info as the following:
2016-02-25 03:08:33,202 [virtwho.main ERROR] MainProcess(1469):MainThread @virtwho.py:send:214 - Error in communication with subscription manager:
Traceback (most recent call last):
  File "/usr/share/virt-who/virtwho.py", line 197, in send
    self._sendGuestAssociation(report)
  File "/usr/share/virt-who/virtwho.py", line 224, in _sendGuestAssociation
    manager.hypervisorCheckIn(report, self.options)
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 198, in hypervisorCheckIn
    retry_after = int(getattr(e, 'headers', {}).get('Retry-After'))
TypeError: int() argument must be a string or a number, not 'NoneType'
2016-02-25 03:08:33,202 [virtwho.main DEBUG] MainProcess(1469):MainThread @virtwho.py:send_current_report:166 - Report from "env/cmdline" failed to sent

Expected results:
It shouldn't show TypeError exception in virt-who log, Retry-After should get correct type.

Additional info:
Please see the detail error info in attachment virt-who.log

Comment 1 Liushihui 2016-02-25 09:41:03 UTC
Created attachment 1130456 [details]
virt-who log

Comment 2 Radek Novacek 2016-02-25 09:45:25 UTC
This should be fixed in virt-who-0.16-5.el6.noarch.

Comment 4 Liushihui 2016-03-23 08:48:56 UTC
Verified it on virt-who-0.16-7.el6 since it will show normal log when virt-who received 429 from candlepin. Therefore, verify it.

Verified version:
virt-who-0.16-7.el6
subscription-manager-1.16.8-7.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

Verified process:
1.Register system to stage candlepin
2.Configure virt-who monitor esx and hyperv as the following:
[root@sgi-xe500-01 ~]# cat /etc/virt-who.d/virt
[test-esx1]
type=esx
server=10.73.2.95
username=Administrator
password=Welcome1!
owner=ACME_Corporation
env=Library
hypervisor_id=hostname
[root@sgi-xe500-01 ~]# cat /etc/sysconfig/virt-who  | grep -v ^# | grep -v ^$
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=2
VIRTWHO_HYPERV=1
VIRTWHO_HYPERV_OWNER=ACME_Corporation
VIRTWHO_HYPERV_ENV=Library
VIRTWHO_HYPERV_SERVER=10.73.5.212
VIRTWHO_HYPERV_USERNAME=administrator
VIRTWHO_HYPERV_PASSWORD=Welcome1
3. Restart virt-who service and monitor virt-who's log
[root@sgi-xe500-01 ~]# service virt-who restart
[root@sgi-xe500-01 ~]# tail -f /var/log/rhsm/rhsm.log

2016-03-23 04:45:32,966 [virtwho.main DEBUG] MainProcess(22631):MainThread @virtwho.py:send_report:175 - 429 received, waiting 60 seconds until sending again

Result:
It will show normal log when received 429.

Comment 6 errata-xmlrpc 2016-05-10 23:57:38 UTC
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.

https://rhn.redhat.com/errata/RHEA-2016-0859.html