mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Fix auth in collins.py inventory
This forces basic auth to be used. Using the normal HTTPPasswordMgrWithDefaultRealm password manager from urllib2 fails since collins doesn't send a 401 retry on failure. More about this can be seen here http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-problem. I added a small comment about the format of the host so others don't waste time like i did.
This commit is contained in:
committed by
Brian Coca
parent
3fd13aaffe
commit
21813ed83e
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
[collins]
|
[collins]
|
||||||
|
|
||||||
|
# You should not have a trailing slash or collins
|
||||||
|
# will not properly match the URI
|
||||||
host = http://localhost:9000
|
host = http://localhost:9000
|
||||||
|
|
||||||
username = blake
|
username = blake
|
||||||
|
|||||||
@@ -201,7 +201,8 @@ class CollinsInventory(object):
|
|||||||
response = open_url(query_url,
|
response = open_url(query_url,
|
||||||
timeout=self.collins_timeout_secs,
|
timeout=self.collins_timeout_secs,
|
||||||
url_username=self.collins_username,
|
url_username=self.collins_username,
|
||||||
url_password=self.collins_password)
|
url_password=self.collins_password,
|
||||||
|
force_basic_auth=True)
|
||||||
json_response = json.loads(response.read())
|
json_response = json.loads(response.read())
|
||||||
# Adds any assets found to the array of assets.
|
# Adds any assets found to the array of assets.
|
||||||
assets += json_response['data']['Data']
|
assets += json_response['data']['Data']
|
||||||
|
|||||||
Reference in New Issue
Block a user