From 461f05382cf845e9a4f763ea75014d3e0a0a2aea Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 21 Jan 2008 16:17:12 +0000
Subject: [PATCH] Check that we have a valid export list

Before iterating over the list of exports present on a node, check that what
ganeti returned is actually a list. This solves the case when one of the nodes
is down, and an error value is returned.

This fixes issue 21

Reviewed-by: imsnah
---
 scripts/gnt-backup | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/gnt-backup b/scripts/gnt-backup
index 660cb6182..e90849892 100755
--- a/scripts/gnt-backup
+++ b/scripts/gnt-backup
@@ -43,8 +43,11 @@ def PrintExportList(opts, args):
   for node in exports:
     print ("Node: %s" % node)
     print ("Exports:")
-    for instance_name in exports[node]:
-      print ("\t%s" % instance_name)
+    if isinstance(exports[node], list):
+      for instance_name in exports[node]:
+        print ("\t%s" % instance_name)
+    else:
+      print ("  Could not get exports list")
 
 
 def ExportInstance(opts, args):
-- 
GitLab