diff --git a/virtinst/install/cloudinit.py b/virtinst/install/cloudinit.py index e63654672..931d40b4b 100644 --- a/virtinst/install/cloudinit.py +++ b/virtinst/install/cloudinit.py @@ -12,7 +12,7 @@ class CloudInitData(): generated_root_password = None ssh_key = None - def generate_password(self): + def _generate_password(self): self.generated_root_password = "" for dummy in range(16): self.generated_root_password += random.choice(string.ascii_letters + string.digits) @@ -22,11 +22,14 @@ class CloudInitData(): with open(pwdfile, "r") as fobj: return fobj.readline().rstrip("\n\r") - def get_root_password(self): + def get_password_if_generated(self): if self.root_password_generate: - return self.generate_password() - elif self.root_password_file: + return self._generate_password() + + def get_root_password(self): + if self.root_password_file: return self._get_password(self.root_password_file) + return self.get_password_if_generated() def get_ssh_key(self): if self.ssh_key: diff --git a/virtinst/install/installer.py b/virtinst/install/installer.py index 34f47ac49..a0ac63ab5 100644 --- a/virtinst/install/installer.py +++ b/virtinst/install/installer.py @@ -433,7 +433,7 @@ class Installer(object): def get_generated_password(self): if self._cloudinit_data: - return self._cloudinit_data.generate_password() + return self._cloudinit_data.get_password_if_generated() ##########################