From 04b15f0dba1398b504f048b4bf22b626bf61798a Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 25 Nov 2019 13:49:26 -0500 Subject: [PATCH] cloudinit: Don't regenerate root password Store the first one we generate for later usage Signed-off-by: Cole Robinson --- virtinst/install/cloudinit.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/virtinst/install/cloudinit.py b/virtinst/install/cloudinit.py index 93516914..78b55ca6 100644 --- a/virtinst/install/cloudinit.py +++ b/virtinst/install/cloudinit.py @@ -22,9 +22,11 @@ class CloudInitData(): meta_data = None def _generate_password(self): - self.generated_root_password = "" - for dummy in range(16): - self.generated_root_password += random.choice(string.ascii_letters + string.digits) + 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) return self.generated_root_password def _get_password(self, pwdfile):