[Kimchi-devel] [PATCH] bug fix: Auto-generate guest console password when the passed value is an empty string

Aline Manera alinefm at linux.vnet.ibm.com
Fri Aug 29 19:28:02 UTC 2014


As the password will be an empty string we need to check if its value is
not None, otherwise the password will not be generated.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 src/kimchi/model/vms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index e91c0ed..d8a02cd 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -312,7 +312,7 @@ class VMModel(object):
             return xml
 
         password = params['graphics'].get("passwd")
-        if password and len(password.strip()) == 0:
+        if password is not None and len(password.strip()) == 0:
             password = "".join(random.sample(string.ascii_letters +
                                              string.digits, 8))
 
-- 
1.9.3




More information about the Kimchi-devel mailing list