Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1608820

Summary: AttributeError: 'module' object has no attribute 'foo' when list config values after setting --logging.default_log_level to a bad value
Product: Red Hat Enterprise Linux 7 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED WONTFIX QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: low    
Version: 7.6CC: csnyder, jsefler, khowell, tmerry
Target Milestone: rcKeywords: EasyFix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1920020 (view as bug list) Environment:
Last Closed: 2021-01-25 15:08:56 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: 1920020    

Description Rehana 2018-07-26 10:28:50 UTC
Description of problem:
Observed that user was allowed to set a bad value for --logging.default_log_level of config command. Once the bad value was set every subscription-manager commands failes with Attribute error

Version-Release number of selected component (if applicable):
subscription-manager-rhsm-certificates-1.21.5-5.el7.x86_64
subscription-manager-gui-1.21.5-5.el7.x86_64
subscription-manager-rhsm-1.21.5-5.el7.x86_64
subscription-manager-1.21.5-5.el7.x86_64
subscription-manager-initial-setup-addon-1.21.5-5.el7.x86_64
subscription-manager-cockpit-1.21.5-5.el7.noarch
subscription-manager-plugin-container-1.21.5-5.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1.set bad value for config 
[root@dhcp35-40 ~]# subscription-manager config --logging.default_log_level=foo


List config 

[root@dhcp35-40 ~]# subscription-manager config --list
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.21.5', 'console_scripts', 'subscription-manager')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 60, in <module>
    logutil.init_logger()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/logutil.py", line 151, in init_logger
    logger.setLevel(getattr(logging, default_log_level.strip()))
AttributeError: 'module' object has no attribute 'foo'

version 
[root@dhcp35-40 ~]# subscription-manager version
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.21.5', 'console_scripts', 'subscription-manager')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 60, in <module>
    logutil.init_logger()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/logutil.py", line 151, in init_logger
    logger.setLevel(getattr(logging, default_log_level.strip()))
AttributeError: 'module' object has no attribute 'foo'


2.
3.

Actual results:
User was allowed to set a bad value for logging.default_log_level and that broke almost every subscription-manager commands

Expected results:

User should not be allowed to set bad values for default_log_level
Additional info:

Comment 3 Chris Snyder 2018-08-16 19:54:32 UTC
Deferring to RHEL 7.7 as the fix for this will not make it into RHEL 7.6 at this point in the cycle.

Comment 5 Rehana 2021-01-25 15:08:56 UTC
Cloned to RHEL 8 Bug 1920020