This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1472715 - Python module rhsm should never call exit()
Python module rhsm should never call exit()
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Jiri Hnidek
John Sefler
Depends On:
  Show dependency treegraph
Reported: 2017-07-19 04:48 EDT by Jiri Hnidek
Modified: 2017-10-09 16:45 EDT (History)
3 users (show)

See Also:
Fixed In Version: subscription-manager-1.20.2-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Github candlepin/subscription-manager/pull/1668 None None None 2017-07-19 06:30 EDT

  None (edit)
Description Jiri Hnidek 2017-07-19 04:48:19 EDT
Description of problem:
Python module rhsm is used by other projects (e.g. virt-who) and it should not call exit(), but it should raise some exception, because application using rhsm module cannot resurrect from calling exit() by some external module.

Version-Release number of selected component (if applicable):
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.37-1
subscription management rules: 5.24.1
subscription-manager: 1.19.12-1.el7
python-rhsm: 1.19.6-1.el7

How reproducible:

Steps to Reproduce:
1. Start Python interpreter:

$ python

2. Import rhsm submodule called 'certificate'

>>> import python_rhsm.certificate

3. Try to get certificate from some non-existent file:

>>> c = python_rhsm.certificate.create_from_file('/foo/non_existing_cert.pem')
No such file or directory

Actual results:
Python interpreter is terminated as well any other program trying to do similar thing.

Expected results:
Calling python_rhsm.certificate.create_from_file('/foo/non_existing_cert.pem') should raise some exception.

Additional info:
This can happen in production, when system is not registered and there is no file: /etc/pki/consumer/cert.pem. There are no other exit() call in rhsm module only one in: python-rhsm/src/rhsm/

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