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

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@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

-- Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On Fri, 2014-08-29 at 16:28 -0300, Aline Manera wrote:
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@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))

Applied. Thanks. Regards, Aline Manera
participants (2)
-
Aline Manera
-
Paulo Ricardo Paz Vital