Bug 889204

Summary: encountering the following stderr msg when subscription name contains UTF8 chars: [priority,] message string
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: bkearney, tlavigne
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 09:05:53 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:
Bug Depends On:    
Bug Blocks: 771481, 863175    

Description John Sefler 2012-12-20 13:53:32 UTC
Description of problem:
As a follow-up to bug 880070 I encounter a stderr with message "[priority,] message string" when attaching/removing a subscription whose name contains UTF8 characters.

Version-Release number of selected component (if applicable):
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.1.18-1.el6.x86_64

How reproducible:


Steps to Reproduce:
1. create a subscription with a name containing UTF8 characters, then...


[root@jsefler-6 ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:    	Subscription name containing UTF–8 character \u2013
SKU:                  	utf8-subscription-sku
Pool Id:              	8a90f82e3bb5d7f1013bb87afd3c3d9d
Quantity:             	20
Service Level:        	
Service Type:         	
Multi-Entitlement:    	No
Ends:                 	01/04/2013
System Type:          	Physical

[root@jsefler-6 ~]# subscription-manager subscribe --pool 8a90f82e3bb5d7f1013bb87afd3c3d9d
Successfully attached a subscription for: Subscription name containing UTF–8 character \u2013
[priority,] message string                <=============================== BANG!

[root@jsefler-6 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+

Subscription Name:    	Subscription name containing UTF–8 character \u2013
Provides:             	
SKU:                  	utf8-subscription-sku
Contract:             	98943705
Account:              	1781079502
Serial Number:        	9044721319435475545
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	12/19/2012
Ends:                 	01/04/2013

[root@jsefler-6 ~]# subscription-manager unsubscribe --serial 9044721319435475545
Successfully removed serial numbers:
   9044721319435475545
[priority,] message string                <=============================== BANG!

[root@jsefler-6 ~]# subscription-manager subscribe --pool 8a90f82e3bb5d7f1013bb87afd3c3d9d
Successfully attached a subscription for: Subscription name containing UTF–8 character \u2013
[priority,] message string                <=============================== BANG!

[root@jsefler-6 ~]# subscription-manager unsubscribe --all
1 subscription removed from this system.
[priority,] message string                <=============================== BANG!

[root@jsefler-6 ~]# echo $?
255




  
Actual results:
above

Expected results:
should not encounter the stderr messages "[priority,] message string"




Additional info:
[root@jsefler-6 ~]# tail -f /var/log/rhsm/rhsm.log

2012-12-20 08:48:55,307 [ERROR]  @managercli.py:115 - Unable to attach: [priority,] message string
2012-12-20 08:48:55,308 [ERROR]  @managercli.py:116 - [priority,] message string
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1355, in _do_command
    result = self.certlib.update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 61, in update
    return self._do_update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 84, in _do_update
    return action.perform()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 226, in perform
    self.syslogResults(report)
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 252, in syslogResults
    (cert.order.name, cert.order.contract))
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 40, in system_log
    syslog.syslog(priority, message)
TypeError: [priority,] message string


2012-12-20 08:50:04,445 [ERROR]  @managercli.py:115 - Unable to perform remove due to the following exception: [priority,] message string
2012-12-20 08:50:04,445 [ERROR]  @managercli.py:116 - [priority,] message string
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1471, in _do_command
    self.certlib.update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 61, in update
    return self._do_update()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 84, in _do_update
    return action.perform()
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 226, in perform
    self.syslogResults(report)
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 258, in syslogResults
    (cert.order.name, cert.order.contract))
  File "/usr/share/rhsm/subscription_manager/certlib.py", line 40, in system_log
    syslog.syslog(priority, message)
TypeError: [priority,] message string

Comment 1 RHEL Program Management 2012-12-24 06:53:25 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 2 Bryan Kearney 2013-01-02 19:51:34 UTC
Fixed in master at https://github.com/candlepin/subscription-manager/pull/471

Comment 3 Bryan Kearney 2013-01-04 16:37:14 UTC
commit 8da0f99018371c754aea5a87b2d1eb8eb0ccc4df
Author: Bryan Kearney <bkearney>
Date:   Wed Jan 2 14:49:05 2013 -0500

    889204: Encode the unicode string to utf-8 to avoid syslog errors

Comment 4 John Sefler 2013-01-04 18:14:59 UTC
also see similar bug 890296

Comment 6 John Sefler 2013-01-07 22:30:08 UTC
Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.1.19-1.el6.x86_64


[root@jsefler-6 ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:    	Subscription name containing UTF–8 character \u2013
SKU:                  	utf8-subscription-sku
Pool Id:              	8a90f81d3c159143013c16fd0baa0cb9
Quantity:             	20
Service Level:        	
Service Type:         	
Multi-Entitlement:    	No
Ends:                 	01/22/2013
System Type:          	Physical

[root@jsefler-6 ~]# subscription-manager subscribe --pool 8a90f81d3c159143013c16fd0baa0cb9
Successfully attached a subscription for: Subscription name containing UTF–8 character \u2013
[root@jsefler-6 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+

Subscription Name:    	Subscription name containing UTF–8 character \u2013
Provides:             	
SKU:                  	utf8-subscription-sku
Contract:             	1554692394
Account:              	237306038
Serial Number:        	8286469716699169978
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	01/06/2013
Ends:                 	01/22/2013

[root@jsefler-6 ~]# rct cat-cert /etc/pki/entitlement/8286469716699169978.pem 

+-------------------------------------------+
	Entitlement Certificate
+-------------------------------------------+

Certificate:
	Path: /etc/pki/entitlement/8286469716699169978.pem
	Version: 3.1
	Serial: 8286469716699169978
	Start Date: 2013-01-06 21:49:06+00:00
	End Date: 2013-01-22 21:49:06+00:00

Subject:
	CN: 8a90f81d3c159143013c171cf5470ce1


Order:
	Name: Subscription name containing UTF–8 character \u2013
	Number: 8a90f81d3c159143013c16fd06f50cb7
	SKU: utf8-subscription-sku
	Contract: 1554692394
	Account: 237306038
	Service Level: 
	Service Type: 
	Quantity: 20
	Quantity Used: 1
	Socket Limit: 
	RAM Limit: 
	Virt Limit: 
	Virt Only: False
	Subscription: 
	Stacking ID: 
	Warning Period: 0
	Provides Management: False

[root@jsefler-6 ~]# subscription-manager unsubscribe --serial 8286469716699169978
Successfully removed serial numbers:
   8286469716699169978
[root@jsefler-6 ~]# subscription-manager subscribe --pool 8a90f81d3c159143013c16fd0baa0cb9
Successfully attached a subscription for: Subscription name containing UTF–8 character \u2013
[root@jsefler-6 ~]# subscription-manager unsubscribe --all
1 subscription removed from this system.
[root@jsefler-6 ~]# echo $?
0


VERIFIED: The subscription-manager calls above no longer throw "TypeError: [priority,] message string" to stderr when encountering an entitlement whose subscription name contains UTF8 characters

Comment 8 errata-xmlrpc 2013-02-21 09:05:53 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.

http://rhn.redhat.com/errata/RHBA-2013-0350.html