Red Hat Bugzilla – Bug 1472715
Python module rhsm should never call exit()
Last modified: 2017-08-04 17:14:26 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
Steps to Reproduce:
1. Start Python interpreter:
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
Python interpreter is terminated as well any other program trying to do similar thing.
Calling python_rhsm.certificate.create_from_file('/foo/non_existing_cert.pem') should raise some exception.
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/certificate2.py