mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 05:11:25 -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
|
@ -466,6 +466,25 @@ def is_binary_file(path):
|
|||
return b'\0' in path_fd.read(1024)
|
||||
|
||||
|
||||
def generate_password():
|
||||
"""Generate a random password.
|
||||
:rtype: str
|
||||
"""
|
||||
chars = [
|
||||
string.ascii_letters,
|
||||
string.digits,
|
||||
string.ascii_letters,
|
||||
string.digits,
|
||||
'-',
|
||||
] * 4
|
||||
|
||||
password = ''.join([random.choice(char) for char in chars[:-1]])
|
||||
|
||||
display.sensitive.add(password)
|
||||
|
||||
return password
|
||||
|
||||
|
||||
class Display(object):
|
||||
"""Manages color console output."""
|
||||
clear = '\033[0m'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue