mirror of
https://github.com/ansible/awx.git
synced 2026-04-11 04:59:22 -02:30
Add error handling for missing rhsm.conf
This commit is contained in:
committed by
Ryan Petrello
parent
3bb930c769
commit
10242cd6c4
@@ -42,8 +42,9 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def rhsm_config():
|
def rhsm_config():
|
||||||
|
path = '/etc/rhsm/rhsm.conf'
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('/etc/rhsm/rhsm.conf')
|
config.read(path)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
@@ -150,7 +151,10 @@ class Licenser(object):
|
|||||||
|
|
||||||
|
|
||||||
def validate_rh(self, user, pw):
|
def validate_rh(self, user, pw):
|
||||||
host = 'https://' + str(self.config.get("server", "hostname"))
|
try:
|
||||||
|
host = 'https://' + str(self.config.get("server", "hostname"))
|
||||||
|
except:
|
||||||
|
raise OSError('Cannot access rhsm.conf, make sure subscription manager is installed and configured.')
|
||||||
if not host:
|
if not host:
|
||||||
host = getattr(settings, 'REDHAT_CANDLEPIN_HOST', None)
|
host = getattr(settings, 'REDHAT_CANDLEPIN_HOST', None)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user