More rigorous Fuel environment check 27/14427/1
authorPeter Barabas <peter.barabas@ericsson.com>
Fri, 20 May 2016 09:10:35 +0000 (11:10 +0200)
committerPeter Barabas <peter.barabas@ericsson.com>
Fri, 20 May 2016 09:10:35 +0000 (11:10 +0200)
get_env() used to raise an unhandled exception when reap.py was run on a
Fuel node which didn't yet have an environment set up.

Change-Id: I07c37db2d80e416d26fa4fb4907f4e438f1c44e5
Signed-off-by: Peter Barabas <peter.barabas@ericsson.com>
deploy/reap.py

index bf64d40..22a55e7 100755 (executable)
@@ -92,8 +92,10 @@ class Reap(object):
 
     def get_env(self):
         env_list = parse(exec_cmd('fuel env'))
-        if len(env_list) > 1:
-            err('Not exactly one environment')
+        if len(env_list) == 0:
+            err('No environment deployed')
+        elif len(env_list) > 1:
+            err('More than 1 environment deployed')
         self.env = env_list[0]
         self.env_id = self.env[E['id']]