mirror of
https://github.com/ansible/awx.git
synced 2026-02-18 19:50:05 -03:30
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1417b1e33e | ||
|
|
73187c61f4 |
@@ -242,20 +242,12 @@ class Licenser(object):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
def get_rhsm_subs(self, host, user, pw):
|
def get_rhsm_subs(self, host, user, pw):
|
||||||
verify = getattr(settings, 'REDHAT_CANDLEPIN_VERIFY', True)
|
|
||||||
json = []
|
json = []
|
||||||
try:
|
subs = requests.get('/'.join([host, 'subscription/users/{}/owners'.format(user)]), verify=True, auth=(user, pw))
|
||||||
subs = requests.get('/'.join([host, 'subscription/users/{}/owners'.format(user)]), verify=verify, auth=(user, pw))
|
|
||||||
except requests.exceptions.ConnectionError as error:
|
|
||||||
raise error
|
|
||||||
except OSError as error:
|
|
||||||
raise OSError(
|
|
||||||
'Unable to open certificate bundle {}. Check that the service is running on Red Hat Enterprise Linux.'.format(verify)
|
|
||||||
) from error # noqa
|
|
||||||
subs.raise_for_status()
|
subs.raise_for_status()
|
||||||
|
|
||||||
for sub in subs.json():
|
for sub in subs.json():
|
||||||
resp = requests.get('/'.join([host, 'subscription/owners/{}/pools/?match=*tower*'.format(sub['key'])]), verify=verify, auth=(user, pw))
|
resp = requests.get('/'.join([host, 'subscription/owners/{}/pools/?match=*tower*'.format(sub['key'])]), verify=True, auth=(user, pw))
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
json.extend(resp.json())
|
json.extend(resp.json())
|
||||||
return json
|
return json
|
||||||
@@ -266,8 +258,8 @@ class Licenser(object):
|
|||||||
verify = str(self.config.get("rhsm", "repo_ca_cert"))
|
verify = str(self.config.get("rhsm", "repo_ca_cert"))
|
||||||
port = str(self.config.get("server", "port"))
|
port = str(self.config.get("server", "port"))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
verify = True
|
||||||
logger.exception('Unable to read rhsm config to get ca_cert location. {}'.format(str(e)))
|
logger.exception('Unable to read rhsm config to get ca_cert location. {}'.format(str(e)))
|
||||||
verify = getattr(settings, 'REDHAT_CANDLEPIN_VERIFY', True)
|
|
||||||
if port:
|
if port:
|
||||||
host = ':'.join([host, port])
|
host = ':'.join([host, port])
|
||||||
json = []
|
json = []
|
||||||
|
|||||||
Reference in New Issue
Block a user