Cleanup and enhancements for ansible-test. (#37142)

* Fix type hint typos.
* Add one-time cloud env setup after delegation.
* Add generate_password to util.
* Add username/password support to HttpClient.
* Avoid pip requirement for ansible-test shell.
* Support provisioning Tower instances.
This commit is contained in:
Matt Clay 2018-03-07 14:02:31 -08:00 committed by GitHub
parent 5de7c9ce8f
commit b9b8081a87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 82 additions and 13 deletions

View file

@ -42,6 +42,9 @@ class HttpClient(object):
self.always = always
self.insecure = insecure
self.username = None
self.password = None
def get(self, url):
"""
:type url: str
@ -83,6 +86,13 @@ class HttpClient(object):
headers['Expect'] = '' # don't send expect continue header
if self.username:
if self.password:
display.sensitive.add(self.password)
cmd += ['-u', '%s:%s' % (self.username, self.password)]
else:
cmd += ['-u', self.username]
for header in headers.keys():
cmd += ['-H', '%s: %s' % (header, headers[header])]