You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tower = Tower('localhost', 'username', 'password', secure=True, ssl_verify=False)
for organization in tower.organizations:
for cred in organization.credentials:
print(cred)
Fails on the looping over organization.credentials.
Noticed the line with HTTPSConnectionPool(host='localhosthttps', port=443), which seems to indicate the url is build up wrong for this follow up request.
I have the same error for other iterable variables, not only organization.credentials.
Traceback (most recent call last):
File "./awx_security_audit.py", line 109, in <module>
print_report(tower)
File "./awx_security_audit.py", line 54, in print_report
for cred in organization.credentials:
File "/soft/ansible/home/auditor/venv/lib64/python3.6/site-packages/towerlib/entities/core.py", line 310, in _get_entity_objects
for data in self._tower._get_paginated_response(self._url, params=params): # pylint: disable=protected-access
File "/soft/ansible/home/auditor/venv/lib64/python3.6/site-packages/towerlib/towerlib.py", line 270, in _get_paginated_response
response = self.session.get(url)
File "/soft/ansible/home/auditor/venv/lib64/python3.6/site-packages/requests/sessions.py", line 525, in get
return self.request('GET', url, **kwargs)
File "/soft/ansible/home/auditor/venv/lib64/python3.6/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/soft/ansible/home/auditor/venv/lib64/python3.6/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/soft/ansible/home/auditor/venv/lib64/python3.6/site-packages/requests/adapters.py", line 507, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='localhosthttps', port=443): Max retries exceeded with url: //localhost/api/v2/organizations/7/credentials/?page_size=25 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 notresolvable',)))
The text was updated successfully, but these errors were encountered:
Had a quick look in the code and I guess the guilty line is this last one. But there must be a reason host and url are explicitly appended.
class EntityManager:
"""Manages entities by making them act like iterables but also implements contains and other useful stuff."""
def __init__(self, tower_instance, entity_object, primary_match_field, entity_name=None, url=None): # pylint: disable=too-many-arguments
if not any([entity_name, url]):
raise ValueError('Either entity_name or url needs to be provided, received none.')
self._tower = tower_instance
self._object_type = entity_object
self._primary_match_field = primary_match_field
self._name = entity_name
self._next_state = None
if entity_name:
self._url = '{api}/{entity_name}'.format(api=self._tower.api, entity_name=entity_name)
else:
self._url = '{host}{url}'.format(host=self._tower.host, url=url)
Version 2.1.0 should fix this. The issue was that most entities are represented by their relative url with the api as a base point, but for users, teams, credentials and inventories of organizations the url used was the full one along with the host prefix. Thank you very much for reporting!
Environment: RHEL, Python 3.6, towerlib pip installed earlier today.
My code is more or less this:
Fails on the looping over organization.credentials.
Noticed the line with
HTTPSConnectionPool(host='localhosthttps', port=443)
, which seems to indicate the url is build up wrong for this follow up request.I have the same error for other iterable variables, not only organization.credentials.
The text was updated successfully, but these errors were encountered: