Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9BF95E582 for ; Sat, 26 Jan 2013 16:21:56 +0000 (UTC) Received: (qmail 4851 invoked by uid 500); 26 Jan 2013 16:21:48 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 4781 invoked by uid 500); 26 Jan 2013 16:21:48 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 1417 invoked by uid 99); 26 Jan 2013 16:21:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jan 2013 16:21:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AE1B1825E24; Sat, 26 Jan 2013 16:21:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [13/50] [abbrv] git commit: cli: Fix asyncblock to search for correct key instead of hardcoded index Message-Id: <20130126162139.AE1B1825E24@tyr.zones.apache.org> Date: Sat, 26 Jan 2013 16:21:39 +0000 (UTC) cli: Fix asyncblock to search for correct key instead of hardcoded index Signed-off-by: Rohit Yadav Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d2600dca Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d2600dca Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d2600dca Branch: refs/heads/marvin-refactor-phase1 Commit: d2600dca8a1a88990ce591175d72facf2af72118 Parents: 02ccdf5 Author: Rohit Yadav Authored: Wed Jan 23 14:12:38 2013 -0800 Committer: Prasanna Santhanam Committed: Thu Jan 24 17:48:35 2013 +0530 ---------------------------------------------------------------------- tools/cli/cloudmonkey/cloudmonkey.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d2600dca/tools/cli/cloudmonkey/cloudmonkey.py ---------------------------------------------------------------------- diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py index 339a201..d679e50 100644 --- a/tools/cli/cloudmonkey/cloudmonkey.py +++ b/tools/cli/cloudmonkey/cloudmonkey.py @@ -262,8 +262,9 @@ class CloudMonkeyShell(cmd.Cmd, object): return isAsync = isAsync and (self.asyncblock == "true") - if isAsync and 'jobid' in response[response.keys()[0]]: - jobId = response[response.keys()[0]]['jobid'] + responsekey = filter(lambda x: 'response' in x, response.keys())[0] + if isAsync and 'jobid' in response[responsekey]: + jobId = response[responsekey]['jobid'] command = "queryAsyncJobResult" requests = {'jobid': jobId} timeout = int(self.timeout) @@ -282,7 +283,7 @@ class CloudMonkeyShell(cmd.Cmd, object): jobstatus = result['jobstatus'] if jobstatus == 2: jobresult = result["jobresult"] - self.print_shell("Async query failed for jobid=", + self.print_shell("\rAsync query failed for jobid", jobId, "\nError", jobresult["errorcode"], jobresult["errortext"]) return @@ -293,7 +294,7 @@ class CloudMonkeyShell(cmd.Cmd, object): timeout = timeout - pollperiod progress += 1 logger.debug("job: %s to timeout in %ds" % (jobId, timeout)) - self.print_shell("Error:", "Async query timeout for jobid=", jobId) + self.print_shell("Error:", "Async query timeout for jobid", jobId) return response