Bug 729988

Summary: 'NoneType' object has no attribute 'lower' when subscription-manager register run in kickstart
Product: Red Hat Enterprise Linux 6 Reporter: Pavel Holica <pholica>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: bay, jsefler
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: 2012-06-20 12:56:31 UTC Type: ---
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: 691780, 738066, 756082    

Description Pavel Holica 2011-08-11 13:31:12 UTC
Description of problem:
Running subscription-manager register in kickstart in post section (in chrooted environment) shows error and gives 0 as exit code.

Version-Release number of selected component (if applicable):
subscription-manager-0.95.11-1.el6

How reproducible:
always

Steps to Reproduce:
1. create kickstart with post section looking like this:
%post
echo "subscription-manager output:" > /root/subscription-manager.txt
subscription-manager register --username SOMEUSERNAME --password SOMEPASSWORD >> /root/subscription-manager.txt 2>&1
echo "subscription-manager return code: $?" >> /root/subscription-manager.txt
%end
2. use such kickstart
3. cat /root/subscription-manager.txt
  
Actual results:
subscription-manager output:
'NoneType' object has no attribute 'lower'
subscription-manager return code: 0

Expected results:
subscription-manager output:
some-identifier machine_hostname
subscription-manager return code: 0

Additional info:

Comment 1 Alexander Bersenev 2011-09-20 19:24:03 UTC
I have a same problem. I workarounded it with an export LANG="en_US.UTF-8" command.

The bug is easy reproductable:
[root@tesla16 ~]# subscription-manager register
This system is already registered. Use --force to override
[root@tesla16 ~]# LANG=C subscription-manager register
'NoneType' object has no attribute 'lower'

LANG=C was used during install and subscription-manager doesn't work with it.

Comment 4 John Sefler 2012-01-05 18:25:47 UTC
This may already have been fixed by related bug 700601 bug 702403 bug 702078

Comment 5 Bryan Kearney 2012-02-22 15:37:09 UTC
This has been fixed as John Sefler has stated in comment 4.

Comment 7 John Sefler 2012-03-14 17:13:30 UTC
Reproducing failure on broken version (from rhel61)...
[root@rhsm-compat-rhel61 ~]# rpm -q subscription-manager
subscription-manager-0.95.17-1.el6_1.x86_64
[root@rhsm-compat-rhel61 ~]# LANG=C subscription-manager register
'NoneType' object has no attribute 'lower'
[root@rhsm-compat-rhel61 ~]# echo $?
255
[root@rhsm-compat-rhel61 ~]# 


Verifying fix on latest version (targeting rhel63)...
[root@jsefler-r63-workstation ~]# rpm -q subscription-manager
subscription-manager-0.99.9-1.el6.x86_64
[root@jsefler-r63-workstation ~]# LANG=C subscription-manager register
Username: qa
Password: 
The system has been registered with id: f57f013a-f092-43f6-b9f2-820eb43b8a8c 
[root@jsefler-r63-workstation ~]# echo $?
0
[root@jsefler-r63-workstation ~]# 


moving to VERIFIED

Comment 8 John Sefler 2012-03-14 17:56:35 UTC
Note: If registering from from within the kickstart, you could specify the username and password [and org] as demonstrated in comment 0

[root@jsefler-r63-workstation ~]# LANG=C subscription-manager register --username SOMEUSERNAME --password SOMEPASSWORD 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-r63-workstation ~]# echo $?
0
[root@jsefler-r63-workstation ~]# cat /tmp/stdout
The system has been registered with id: b9a10105-977a-4d50-b37d-2ed05fbad50f 
[root@jsefler-r63-workstation ~]# cat /tmp/stderr
[root@jsefler-r63-workstation ~]# 

^^ This demonstrates that registration with username and password supplied as parameters explicitly using the default fallback C local now works.

Comment 10 errata-xmlrpc 2012-06-20 12:56:31 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-2012-0804.html