cloudinit: Don't regenerate root password

Store the first one we generate for later usage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-11-25 13:49:26 -05:00
parent da996317f8
commit 04b15f0dba
1 changed files with 5 additions and 3 deletions

View File

@ -22,9 +22,11 @@ class CloudInitData():
meta_data = None
def _generate_password(self):
if not self.generated_root_password:
self.generated_root_password = ""
for dummy in range(16):
self.generated_root_password += random.choice(string.ascii_letters + string.digits)
self.generated_root_password += random.choice(
string.ascii_letters + string.digits)
return self.generated_root_password
def _get_password(self, pwdfile):