From 6ed64c6d48c02add457425cb3b238a8a086fb723 Mon Sep 17 00:00:00 2001
From: Seblu <sebastien.luttringer@smartjog.com>
Date: Fri, 25 Feb 2011 16:06:49 +0100
Subject: [PATCH] fix bug in TqlCommand callback call. Fix exec command doesn't
 works.

---
 cccli/command/command.py | 2 +-
 cccli/command/host.py    | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/cccli/command/command.py b/cccli/command/command.py
index 868581b..90f42ad 100644
--- a/cccli/command/command.py
+++ b/cccli/command/command.py
@@ -208,7 +208,7 @@ class TqlCommand(OptionCommand):
                 l[_options["tql_index"]] = "id=%s"%obj["id"]
                 d = self.cli.rpc.call(*tuple(l), **kwargs)
                 if _options["callback"] is not None:
-                    _options["callback"](obj)
+                    _options["callback"](d)
                 if _options["status"]:
                     self.print_objects(d, ["output"], index=False)
             except RpcError as e:
diff --git a/cccli/command/host.py b/cccli/command/host.py
index e533fd4..4d232b4 100644
--- a/cccli/command/host.py
+++ b/cccli/command/host.py
@@ -26,8 +26,10 @@ class Command_exec(TqlCommand):
 
     def _cb_print_output(self, d):
         '''Print output of execute by object'''
-        self.printer.out("%s output:"%d["id"])
-        self.printer.out(d.get("output", ""), nl="")
+        for o in d["objects"]:
+            self.printer.out("%sid:%s%s%s output:"%(self.tdtc("id"), self.tdc("id"),
+                                                    o["id"], color["reset"]))
+            self.printer.out(o.get("output", ""), nl="")
 
 class Command_shutdown(TqlCommand):
     '''Shutdown a physical host'''
-- 
GitLab