Bug 1048325 - rct cat-cert tool is failing to parse an entitlement containing non-ascii character \u2013
Summary: rct cat-cert tool is failing to parse an entitlement containing non-ascii cha...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Carter Kozak
QA Contact: John Sefler
URL: http://faf-report.itos.redhat.com/rep...
Whiteboard:
: 1052840 (view as bug list)
Depends On:
Blocks: rhsm-rhel70
TreeView+ depends on / blocked
 
Reported: 2014-01-03 17:59 UTC by John Sefler
Modified: 2014-09-15 00:09 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 11:17:01 UTC
Target Upstream Version:


Attachments (Terms of Use)
Subscription name containing UTF–8 character \u2013 (1.88 KB, text/x-vhdl)
2014-01-03 17:59 UTC, John Sefler
no flags Details

Description John Sefler 2014-01-03 17:59:59 UTC
Created attachment 845035 [details]
Subscription name containing UTF–8 character \u2013

Description of problem:
Use the attached entitlement to reproduce this failure.

Version-Release number of selected component (if applicable):
[root@jsefler-7server ~]# rpm -q subscription-manager python
subscription-manager-1.10.8-1.el7.x86_64
python-2.7.5-10.el7.x86_64


How reproducible:
Not on every system, but is occuring on compose RHEL-7.0-20140103.n.0 for Server

Steps to Reproduce:
1. download the attached entitlement 952264360179930844.pem to you entitlement directory.  Then....

[root@jsefler-7server ~]# subscription-manager list --consumed 
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Subscription name containing UTF–8 character \u2013
Provides:          
SKU:               utf8-subscription-sku
Contract:          1491108583
Account:           1455260165
Serial:            952264360179930844
Pool ID:           8a90874043539698014353b56bfe1a38
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Starts:            01/01/2014
Ends:              01/17/2014
System Type:       Physical


^ Those results look good.  Now try the rct cat-cert tool....
[root@jsefler-7server ~]# rct cat-cert /etc/pki/entitlement/952264360179930844.pem 
Traceback (most recent call last):
  File "/usr/bin/rct", line 47, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/rct", line 42, in main
    return RctCLI().main()
  File "/usr/share/rhsm/subscription_manager/cli.py", line 166, in main
    return cmd.main()
  File "/usr/share/rhsm/rct/commands.py", line 39, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/rct/cert_commands.py", line 76, in _do_command
    skip_products=self.options.no_products)
  File "/usr/share/rhsm/rct/printing.py", line 228, in printc
    printer.printc(cert)
  File "/usr/share/rhsm/rct/printing.py", line 124, in printc
    print self.cert_to_str(cert)
  File "/usr/share/rhsm/rct/printing.py", line 192, in cert_to_str
    order_printer.as_str(cert.order), "\n".join(s))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 46: ordinal not in range(128)

BANG ^ There's the error.

No additional info in /var/log/rhsm/rhsm.log


Additional info:
[root@jsefler-7server ~]# locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=

Comment 1 Carter Kozak 2014-01-03 18:19:52 UTC
This bug seems to occur on systems using the builtin json module, and not those with simplejson.  I'm not 100% sure that is the cause, but it appears to be one of the few differences between the test systems, and the timeframe is correct.

Comment 2 Carter Kozak 2014-01-13 13:31:56 UTC
commit c07cb2cc61cf18a3b748b8f3381f1d25a51a90ba
Author: ckozak <ckozak@redhat.com>
Date:   Thu Jan 9 14:52:17 2014 -0500

    set default encoding to utf-8 in rhsm-debug and migrate scripts

commit 6fe57f8e6c3c35ac7761b9fa5ac7a6014d69ce20
Author: ckozak <ckozak@redhat.com>
Date:   Fri Jan 3 12:48:25 2014 -0500

    1048325: Set default encoding to utf-8 when running the rct script

Comment 3 Carter Kozak 2014-01-15 13:35:24 UTC
*** Bug 1052840 has been marked as a duplicate of this bug. ***

Comment 7 Sharath Dwaral 2014-01-23 19:53:37 UTC
Version

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.2-1
subscription-manager: 1.10.11-1.el7
python-rhsm: 1.10.11-1.el7


Verification:

# mv ~/Downloads/952264360179930844.pem /etc/pki/entitlement/

# subscription-manager list --consumed

+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Subscription name containing UTF–8 character \u2013
Provides:          
SKU:               utf8-subscription-sku
Contract:          1491108583
Account:           1455260165
Serial:            952264360179930844
Pool ID:           8a90874043539698014353b56bfe1a38
Active:            False
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: 
Starts:            01/01/2014
Ends:              01/17/2014
System Type:       Physical



# rct cat-cert /etc/pki/entitlement/952264360179930844.pem

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

Certificate:
	Path: /etc/pki/entitlement/952264360179930844.pem
	Version: 3.2
	Serial: 952264360179930844
	Start Date: 2014-01-01 16:07:13+00:00
	End Date: 2014-01-17 16:07:13+00:00
	Pool ID: 8a90874043539698014353b56bfe1a38

Subject:
	CN: 8a90874043539698014353b5bd631a65

Issuer:
	C: US
	CN: jsefler-f14-candlepin.usersys.redhat.com
	L: Raleigh


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



VERIFIED

Comment 9 Ludek Smid 2014-06-13 11:17:01 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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