mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-30 06:11:26 -07:00
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:
parent
5de7c9ce8f
commit
b9b8081a87
8 changed files with 82 additions and 13 deletions
|
@ -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])]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue