If no group is given in gnt-network connect/disconnect
commands, the client uses the result of QueryGroups() which
is a list of lists. Use itertools.chain() to handle the
return value correctly.

Signed-off-by: Dimitris Aragiorgis <dim...@grnet.gr>
---
 lib/client/gnt_network.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/client/gnt_network.py b/lib/client/gnt_network.py
index 3427370..d5c02b6 100644
--- a/lib/client/gnt_network.py
+++ b/lib/client/gnt_network.py
@@ -25,6 +25,7 @@
 # W0614: Unused import %s from wildcard import (since we need cli)
 
 import textwrap
+import itertools
 
 from ganeti.cli import *
 from ganeti import constants
@@ -99,7 +100,7 @@ def ConnectNetwork(opts, args):
   cl = GetClient()
 
   if not groups:
-    (groups, ) = cl.QueryGroups([], ["uuid"], False)
+    groups = itertools.chain(*cl.QueryGroups([], ["uuid"], False))
 
   # TODO: Change logic to support "--submit"
   for group in groups:
@@ -127,7 +128,7 @@ def DisconnectNetwork(opts, args):
   cl = GetClient()
 
   if not groups:
-    (groups, ) = cl.QueryGroups([], ["uuid"], False)
+    groups = itertools.chain(*cl.QueryGroups([], ["uuid"], False))
 
   # TODO: Change logic to support "--submit"
   for group in groups:
-- 
1.7.10.4

Attachment: signature.asc
Description: Digital signature

Reply via email to