mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00: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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user