Bug 1449824 - facts collection can abort with unknown locale
Summary: facts collection can abort with unknown locale
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Jiri Hnidek
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-10 19:59 UTC by John Sefler
Modified: 2017-08-01 19:23 UTC (History)
4 users (show)

Fixed In Version: subscription-manager-1.19.14-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 19:23:41 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1625 None None None 2017-05-12 08:17:24 UTC
Red Hat Product Errata RHBA-2017:2083 normal SHIPPED_LIVE python-rhsm and subscription-manager bug fix and enhancement update 2017-08-01 18:14:19 UTC

Description John Sefler 2017-05-10 19:59:35 UTC
Description of problem:
When the locale is unknown, facts collection (as well as registration) should still work.  The new fact (from RFE Bug 1425922) should simply be "Unknown".

This is a regression from the prior RHEL7.3 release.


Version-Release number of selected component (if applicable):
[root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.19.12-1.el7.x86_64
python-rhsm-1.19.6-1.el7.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel7 ~]# LANG=foo subscription-manager facts
unknown locale: foo
[root@jsefler-rhel7 ~]# echo $?
70
[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsm.log
2017-05-10 15:45:34,525 [ERROR] subscription-manager:9245:MainThread @managercli.py:179 - exception caught in subscription-manager
2017-05-10 15:45:34,526 [ERROR] subscription-manager:9245:MainThread @managercli.py:180 - unknown locale: foo
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 89, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 80, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 2829, in main
    return CLI.main(self)
  File "/usr/lib/python2.7/site-packages/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 566, in main
    return_code = self._do_command()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1911, in _do_command
    facts_dict = facts.get_facts()
  File "/usr/lib/python2.7/site-packages/subscription_manager/facts.py", line 79, in get_facts
    facts = collector.get_all()
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/all.py", line 31, in get_all
    results.update(fact_collector.get_all())
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/host_collector.py", line 71, in get_all
    if locale.getdefaultlocale()[0] is not None:
  File "/usr/lib64/python2.7/locale.py", line 511, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.7/locale.py", line 443, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: foo


[root@jsefler-rhel7 ~]# LANG=foo subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: qa@redhat.com
Password: 
unknown locale: foo
[root@jsefler-rhel7 ~]# echo $?
70


Actual results:
  above

Expected results:
  The facts should still list.  Likewise registration should still pass.
  The facts list should show system.default_locale: Unknown like this...
[root@jsefler-rhel7 ~]# LANG=foo subscription-manager facts | grep locale
system.default_locale: Unknown




Additional info:
Notice the regression from the released RHSM packages from RHEL7.3...
[root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.17.15-1.el7.x86_64
python-rhsm-1.19.6-1.el7.x86_64

[root@jsefler-rhel7 ~]# LANG=foo subscription-manager facts
cpu.core(s)_per_socket: 1
cpu.cpu(s): 2
cpu.cpu_socket(s): 2
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Maipo
distribution.name: Red Hat Enterprise Linux Server
distribution.version: 7.4
distribution.version.modifier: beta
dmi.bios.address: 0xe8000
dmi.bios.bios_revision: 0.0
dmi.bios.release_date: 04/01/2014
dmi.bios.rom_size: 64 KB
dmi.bios.runtime_size: 96 KB
dmi.bios.vendor: SeaBIOS
dmi.bios.version: 1.8.1-20150318_183358-
dmi.chassis.asset_tag: Unknown
dmi.chassis.boot-up_state: Safe
dmi.chassis.lock: Not Present
dmi.chassis.manufacturer: QEMU
dmi.chassis.power_supply_state: Safe
dmi.chassis.security_status: Unknown
dmi.chassis.serial_number: Unknown
dmi.chassis.thermal_state: Safe
dmi.chassis.type: Other
dmi.chassis.version: pc-i440fx-2.3
dmi.memory.array_handle: 0x1000
dmi.memory.assettag: Unknown
dmi.memory.bank_locator: Unknown
dmi.memory.data_width: Unknown
dmi.memory.error_correction_type: Multi-bit ECC
dmi.memory.error_information_handle: Not Provided
dmi.memory.form_factor: DIMM
dmi.memory.location: Other
dmi.memory.locator: DIMM 0
dmi.memory.manufacturer: QEMU
dmi.memory.maximum_capacity: 1 GB
dmi.memory.part_number: Unknown
dmi.memory.serial_number: Unknown
dmi.memory.size: 1024 MB
dmi.memory.speed:   (ns)
dmi.memory.total_width: Unknown
dmi.memory.type: RAM
dmi.memory.use: System Memory
dmi.processor.asset_tag: Unknown
dmi.processor.family: Other
dmi.processor.part_number: Unknown
dmi.processor.serial_number: Unknown
dmi.processor.socket_designation: CPU 1
dmi.processor.status: Populated:Enabled
dmi.processor.type: Central Processor
dmi.processor.upgrade: Other
dmi.processor.version: pc-i440fx-2.3
dmi.processor.voltage: Unknown
dmi.system.family: Unknown
dmi.system.manufacturer: QEMU
dmi.system.product_name: Standard PC (i440FX + PIIX, 1996)
dmi.system.serial_number: Unknown
dmi.system.sku_number: Unknown
dmi.system.status: No errors detected
dmi.system.uuid: B38958CC-3115-44AB-AFEF-14258D802C3D
dmi.system.version: pc-i440fx-2.3
dmi.system.wake-up_type: Power Switch
lscpu.architecture: x86_64
lscpu.bogomips: 4799.99
lscpu.byte_order: Little Endian
lscpu.core(s)_per_socket: 1
lscpu.cpu(s): 2
lscpu.cpu_family: 6
lscpu.cpu_mhz: 2399.998
lscpu.cpu_op-mode(s): 32-bit, 64-bit
lscpu.flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm xsaveopt
lscpu.hypervisor_vendor: KVM
lscpu.l1d_cache: 32K
lscpu.l1i_cache: 32K
lscpu.l2_cache: 4096K
lscpu.model: 42
lscpu.model_name: Intel Xeon E312xx (Sandy Bridge)
lscpu.numa_node(s): 1
lscpu.numa_node0_cpu(s): 0,1
lscpu.on-line_cpu(s)_list: 0,1
lscpu.socket(s): 2
lscpu.stepping: 1
lscpu.thread(s)_per_core: 1
lscpu.vendor_id: GenuineIntel
lscpu.virtualization_type: full
memory.memtotal: 1016200
memory.swaptotal: 1048572
net.interface.eth0.ipv4_address: 10.16.7.94
net.interface.eth0.ipv4_address_list: 10.16.7.94
net.interface.eth0.ipv4_broadcast: 10.16.7.255
net.interface.eth0.ipv4_broadcast_list: 10.16.7.255
net.interface.eth0.ipv4_netmask: 22
net.interface.eth0.ipv4_netmask_list: 22
net.interface.eth0.ipv6_address.global: 2620:52:0:1007:5054:ff:feed:8b50
net.interface.eth0.ipv6_address.global_list: 2620:52:0:1007:5054:ff:feed:8b50
net.interface.eth0.ipv6_address.link: fe80::5054:ff:feed:8b50
net.interface.eth0.ipv6_address.link_list: fe80::5054:ff:feed:8b50
net.interface.eth0.ipv6_netmask.global: 64
net.interface.eth0.ipv6_netmask.global_list: 64
net.interface.eth0.ipv6_netmask.link: 64
net.interface.eth0.ipv6_netmask.link_list: 64
net.interface.eth0.mac_address: 52:54:00:ED:8B:50
net.interface.lo.ipv4_address: 127.0.0.1
net.interface.lo.ipv4_address_list: 127.0.0.1
net.interface.lo.ipv4_broadcast: Unknown
net.interface.lo.ipv4_broadcast_list: Unknown
net.interface.lo.ipv4_netmask: 8
net.interface.lo.ipv4_netmask_list: 8
net.interface.lo.ipv6_address.host: ::1
net.interface.lo.ipv6_address.host_list: ::1
net.interface.lo.ipv6_netmask.host: 128
net.interface.lo.ipv6_netmask.host_list: 128
network.hostname: jsefler-rhel7.usersys.redhat.com
network.ipv4_address: 10.16.7.94
network.ipv6_address: fe80::5054:ff:feed:8b50, 2620:52:0:1007:5054:ff:feed:8b50
proc_cpuinfo.common.address_sizes: 40 bits physical, 48 bits virtual
proc_cpuinfo.common.bogomips: 4799.99
proc_cpuinfo.common.cache_alignment: 64
proc_cpuinfo.common.cache_size: 4096 KB
proc_cpuinfo.common.clflush_size: 64
proc_cpuinfo.common.core_id: 0
proc_cpuinfo.common.cpu_cores: 1
proc_cpuinfo.common.cpu_family: 6
proc_cpuinfo.common.cpu_mhz: 2399.998
proc_cpuinfo.common.cpuid_level: 13
proc_cpuinfo.common.flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm xsaveopt
proc_cpuinfo.common.fpu: yes
proc_cpuinfo.common.fpu_exception: yes
proc_cpuinfo.common.microcode: 0x1
proc_cpuinfo.common.model: 42
proc_cpuinfo.common.model_name: Intel Xeon E312xx (Sandy Bridge)
proc_cpuinfo.common.power_management: Unknown
proc_cpuinfo.common.siblings: 1
proc_cpuinfo.common.stepping: 1
proc_cpuinfo.common.vendor_id: GenuineIntel
proc_cpuinfo.common.wp: yes
system.certificate_version: 3.2
uname.machine: x86_64
uname.nodename: jsefler-rhel7.usersys.redhat.com
uname.release: 3.10.0-632.el7.x86_64
uname.sysname: Linux
uname.version: #1 SMP Mon Mar 27 22:53:17 EDT 2017
virt.host_type: kvm
virt.is_guest: True
virt.uuid: B38958CC-3115-44AB-AFEF-14258D802C3D

[root@jsefler-rhel7 ~]# LANG=foo subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: qa@redhat.com
Password: 
The system has been registered with ID: 97aaedb6-9a76-4691-b17c-f9b84fce3e1d 
[root@jsefler-rhel7 ~]#

Comment 3 Shwetha Kallesh 2017-05-18 08:16:03 UTC
Reproducer:

[root@dhcp71-112 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.51.21-1
subscription management rules: 5.15.1
subscription-manager: 1.19.13-1.el7
python-rhsm: 1.19.6-1.el7


[root@dhcp71-112 ~]# LANG=foo subscription-manager facts
unknown locale: foo
[root@dhcp71-112 ~]# echo $?
70
[root@dhcp71-112 ~]# tail -f /var/log/rhsm/rhsm.log
    facts = collector.get_all()
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/all.py", line 31, in get_all
    results.update(fact_collector.get_all())
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/host_collector.py", line 71, in get_all
    if locale.getdefaultlocale()[0] is not None:
  File "/usr/lib64/python2.7/locale.py", line 511, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.7/locale.py", line 443, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: foo
^C
[root@dhcp71-112 ~]# LANG=foo subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: shwetha_tier1_test
Password: 
unknown locale: foo
[root@dhcp71-112 ~]# echo $?
70
[root@dhcp71-112 ~]# tail -f /var/log/rhsm/rhsm.log
    facts = collector.get_all()
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/all.py", line 31, in get_all
    results.update(fact_collector.get_all())
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/host_collector.py", line 71, in get_all
    if locale.getdefaultlocale()[0] is not None:
  File "/usr/lib64/python2.7/locale.py", line 511, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.7/locale.py", line 443, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: foo


Verification:

[root@dhcp71-112 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.23-1
subscription management rules: 5.15.1
subscription-manager: 1.19.14-1.el7
python-rhsm: 1.19.6-1.el7


[root@dhcp71-112 ~]# LANG=foo subscription-manager facts
cpu.core(s)_per_socket: 1
cpu.cpu(s): 1
cpu.cpu_socket(s): 1
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Maipo
distribution.name: Red Hat Enterprise Linux Server
distribution.version: 7.4
distribution.version.modifier: beta
dmi.bios.address: 0xe8000
dmi.bios.bios_revision: 1.0
dmi.bios.release_date: 01/01/2011
dmi.bios.rom_size: 64 KB
dmi.bios.runtime_size: 96 KB
dmi.bios.vendor: Seabios
dmi.bios.version: 0.5.1
dmi.chassis.asset_tag: Unknown
dmi.chassis.boot-up_state: Safe
dmi.chassis.lock: Not Present
dmi.chassis.manufacturer: Bochs
dmi.chassis.power_supply_state: Safe
dmi.chassis.security_status: Unknown
dmi.chassis.serial_number: Unknown
dmi.chassis.thermal_state: Safe
dmi.chassis.type: Other
dmi.chassis.version: Unknown
dmi.memory.array_handle: 0x1000
dmi.memory.bank_locator: Unknown
dmi.memory.data_width: 64 bit
dmi.memory.error_correction_type: Multi-bit ECC
dmi.memory.error_information_handle: Not Provided
dmi.memory.form_factor: DIMM
dmi.memory.location: Other
dmi.memory.locator: DIMM 0
dmi.memory.maximum_capacity: 1 GB
dmi.memory.size: 1024 MB
dmi.memory.speed:   (ns)
dmi.memory.total_width: 64 bit
dmi.memory.type: RAM
dmi.memory.use: System Memory
dmi.meta.cpu_socket_count: 1
dmi.processor.family: Other
dmi.processor.socket_designation: CPU 1
dmi.processor.status: Populated:Enabled
dmi.processor.type: Central Processor
dmi.processor.upgrade: Other
dmi.processor.version: Unknown
dmi.processor.voltage: Unknown
dmi.system.family: Red Hat Enterprise Linux
dmi.system.manufacturer: Red Hat
dmi.system.product_name: KVM
dmi.system.serial_number: Unknown
dmi.system.sku_number: Unknown
dmi.system.status: No errors detected
dmi.system.uuid: 4ef8e78b-423a-4eb6-8d12-44f34b4b903b
dmi.system.version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
dmi.system.wake-up_type: Power Switch
lscpu.architecture: x86_64
lscpu.bogomips: 4787.99
lscpu.byte_order: Little Endian
lscpu.core(s)_per_socket: 1
lscpu.cpu(s): 1
lscpu.cpu_family: 6
lscpu.cpu_mhz: 2393.998
lscpu.cpu_op-mode(s): 32-bit, 64-bit
lscpu.flags: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm
lscpu.hypervisor_vendor: KVM
lscpu.l1d_cache: 32K
lscpu.l1i_cache: 32K
lscpu.l2_cache: 4096K
lscpu.model: 26
lscpu.model_name: Intel Core i7 9xx (Nehalem Class Core i7)
lscpu.numa_node(s): 1
lscpu.numa_node0_cpu(s): 0
lscpu.on-line_cpu(s)_list: 0
lscpu.socket(s): 1
lscpu.stepping: 3
lscpu.thread(s)_per_core: 1
lscpu.vendor_id: GenuineIntel
lscpu.virtualization_type: full
memory.memtotal: 1016424
memory.swaptotal: 946172
net.interface.eth0.ipv4_address: 10.16.71.112
net.interface.eth0.ipv4_address_list: 10.16.71.112
net.interface.eth0.ipv4_broadcast: 10.16.71.255
net.interface.eth0.ipv4_broadcast_list: 10.16.71.255
net.interface.eth0.ipv4_netmask: 21
net.interface.eth0.ipv4_netmask_list: 21
net.interface.eth0.ipv6_address.global: 2620:52:0:1040:5054:ff:fe7a:76db
net.interface.eth0.ipv6_address.global_list: 2620:52:0:1040:5054:ff:fe7a:76db
net.interface.eth0.ipv6_address.link: fe80::5054:ff:fe7a:76db
net.interface.eth0.ipv6_address.link_list: fe80::5054:ff:fe7a:76db
net.interface.eth0.ipv6_netmask.global: 64
net.interface.eth0.ipv6_netmask.global_list: 64
net.interface.eth0.ipv6_netmask.link: 64
net.interface.eth0.ipv6_netmask.link_list: 64
net.interface.eth0.mac_address: 52:54:00:7A:76:DB
net.interface.lo.ipv4_address: 127.0.0.1
net.interface.lo.ipv4_address_list: 127.0.0.1
net.interface.lo.ipv4_broadcast: Unknown
net.interface.lo.ipv4_broadcast_list: Unknown
net.interface.lo.ipv4_netmask: 8
net.interface.lo.ipv4_netmask_list: 8
net.interface.lo.ipv6_address.host: ::1
net.interface.lo.ipv6_address.host_list: ::1
net.interface.lo.ipv6_netmask.host: 128
net.interface.lo.ipv6_netmask.host_list: 128
network.fqdn: dhcp71-112.rhts.eng.bos.redhat.com
network.hostname: dhcp71-112.rhts.eng.bos.redhat.com
network.ipv4_address: 10.16.71.112
network.ipv6_address: 2620:52:0:1040:5054:ff:fe7a:76db, fe80::5054:ff:fe7a:76db
proc_cpuinfo.common.address_sizes: 40 bits physical, 48 bits virtual
proc_cpuinfo.common.apicid: 0
proc_cpuinfo.common.bogomips: 4787.99
proc_cpuinfo.common.cache_alignment: 64
proc_cpuinfo.common.cache_size: 4096 KB
proc_cpuinfo.common.clflush_size: 64
proc_cpuinfo.common.core_id: 0
proc_cpuinfo.common.cpu_cores: 1
proc_cpuinfo.common.cpu_family: 6
proc_cpuinfo.common.cpu_mhz: 2393.998
proc_cpuinfo.common.cpuid_level: 4
proc_cpuinfo.common.flags: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm
proc_cpuinfo.common.fpu: yes
proc_cpuinfo.common.fpu_exception: yes
proc_cpuinfo.common.initial_apicid: 0
proc_cpuinfo.common.microcode: 0x1
proc_cpuinfo.common.model: 26
proc_cpuinfo.common.model_name: Intel Core i7 9xx (Nehalem Class Core i7)
proc_cpuinfo.common.physical_id: 0
proc_cpuinfo.common.power_management: Unknown
proc_cpuinfo.common.processor: 0
proc_cpuinfo.common.siblings: 1
proc_cpuinfo.common.stepping: 3
proc_cpuinfo.common.vendor_id: GenuineIntel
proc_cpuinfo.common.wp: yes
system.certificate_version: 3.2
system.default_locale: Unknown     ----> fact is unknown
uname.machine: x86_64
uname.nodename: dhcp71-112.rhts.eng.bos.redhat.com
uname.release: 3.10.0-632.el7.x86_64
uname.sysname: Linux
uname.version: #1 SMP Mon Mar 27 22:53:17 EDT 2017
virt.host_type: kvm
virt.is_guest: True
virt.uuid: 4ef8e78b-423a-4eb6-8d12-44f34b4b903b

[root@dhcp71-112 ~]# echo $?
0

[root@dhcp71-112 ~]# LANG=foo subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com 
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: shwetha_tier1_test
Password: 
The system has been registered with ID: 3f76013f-8643-4a6f-a18c-902fb8e942a9 
[root@dhcp71-112 ~]# echo $?
0

Comment 4 errata-xmlrpc 2017-08-01 19:23:41 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://access.redhat.com/errata/RHBA-2017:2083


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