Closed ningen1 closed 2 years ago
I think you are right. You seem to be instantiating the main tower object with host set to localhost
is that correct?
in my case i am doing:
tower = towerlib.Tower('localhost', username, password, secure=True, ssl_verify=False)
tower.get_jobs_by_name(template_name)
localhost i changed here because i use my public test.domain.name
i am not sure right now why there is a difference between
self._tower.api
and self._tower.host
because other filters and parts of the code seems to work fine when doing queries
entity_name=None
i need to check where entity_name comes from and why it picks _tower.host
instead of _tower.api
EntityManager is an abstruction over the entities that you can get from the service. There are two ways to get them, one is providing the entity name (type in this case) like User
and the other one is targeting the actual url itself for that object like tower_host/url
The reason is that some paginations are easier one way and some the other, if I remember correctly. (its been a while)
for example projects get instantiated like:
@property
def projects(self):
"""The projects that the user is part of.
Returns:
EntityManager: EntityManager of the projects.
"""
url = self._data.get('related', {}).get('projects')
return EntityManager(self._tower,
entity_object='Project',
primary_match_field='name',
url=url)
where organizations like :
@property
def organizations(self):
"""The organizations configured in tower.
Returns:
EntityManager: The manager object for organizations.
"""
return EntityManager(self,
entity_name='organizations',
entity_object='Organization',
primary_match_field='name')
sorry i think i was not correct... i think error comes from somewhere else... closing this
i think i am hitting this
if entity_name else f'{self._tower.host}{url}'
and gettingjobs has failed with exception: HTTPSConnectionPool(host='localhostnone', port=443): Max retries exceeded with url: / (Caused by NewConnection Error('<urllib3.connection.HTTPSConnection object at 0x7f9aa2b4e520>: Failed to establish a new connection: [Errno -2] Name or service not known'))
what do you think