From 698dbc404215d1b260713054813e1df72d2cd725 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Sat, 2 Aug 2014 15:02:04 +0000 Subject: [PATCH] Fixed a ValueError on provisioning cluster If the machine is slow, the remote command may output an empty string. Converting an empty string to an integer results a ValueError, which caused a failure. This patch attempted to fix the error by adding a check for the outputted string before converting to integer. Closes-Bug: 1351624 Change-Id: I38aadaa8c6b3ae9c7f93f90d5144ac8de7aa54d4 --- sahara/plugins/vanilla/hadoop2/run_scripts.py | 2 +- sahara/plugins/vanilla/v1_2_1/run_scripts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sahara/plugins/vanilla/hadoop2/run_scripts.py b/sahara/plugins/vanilla/hadoop2/run_scripts.py index f2194264..04a1e128 100644 --- a/sahara/plugins/vanilla/hadoop2/run_scripts.py +++ b/sahara/plugins/vanilla/hadoop2/run_scripts.py @@ -171,4 +171,4 @@ def _check_datanodes_count(remote, count): 'awk \'{print $3}\'') LOG.debug("Datanode count='%s'" % stdout.rstrip()) - return exit_code == 0 and int(stdout) == count + return exit_code == 0 and stdout and int(stdout) == count diff --git a/sahara/plugins/vanilla/v1_2_1/run_scripts.py b/sahara/plugins/vanilla/v1_2_1/run_scripts.py index 269c5a7a..70981235 100644 --- a/sahara/plugins/vanilla/v1_2_1/run_scripts.py +++ b/sahara/plugins/vanilla/v1_2_1/run_scripts.py @@ -78,7 +78,7 @@ def check_datanodes_count(remote, count): 'awk \'{print \\$3}\'" hadoop') LOG.debug("Datanode count='%s'" % stdout.rstrip()) - return exit_code == 0 and int(stdout) == count + return exit_code == 0 and stdout and int(stdout) == count def mysql_start(remote, mysql_instance):