Updated Branches: refs/heads/master fd6be7a37 -> f05cd3663
marvin: assertions with messages for common.py Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/f05cd366 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/f05cd366 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/f05cd366 Branch: refs/heads/master Commit: f05cd36634c17ad970797e813d8dcfe9a97e8465 Parents: fd6be7a Author: Prasanna Santhanam <[email protected]> Authored: Thu Dec 13 15:25:39 2012 -0800 Committer: Prasanna Santhanam <[email protected]> Committed: Thu Dec 13 15:25:39 2012 -0800 ---------------------------------------------------------------------- tools/marvin/marvin/integration/lib/common.py | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f05cd366/tools/marvin/marvin/integration/lib/common.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py index 5f90110..69aa733 100644 --- a/tools/marvin/marvin/integration/lib/common.py +++ b/tools/marvin/marvin/integration/lib/common.py @@ -81,7 +81,7 @@ def get_zone(apiclient, services=None): zones = apiclient.listZones(cmd) if isinstance(zones, list): - assert len(zones) > 0 + assert len(zones) > 0, "There are no available zones in the deployment" return zones[0] else: raise Exception("Failed to find specified zone.") @@ -100,7 +100,7 @@ def get_pod(apiclient, zoneid, services=None): pods = apiclient.listPods(cmd) if isinstance(pods, list): - assert len(pods) > 0 + assert len(pods) > 0, "No pods found for zone %s"%zoneid return pods[0] else: raise Exception("Exception: Failed to find specified pod.") @@ -129,10 +129,11 @@ def get_template(apiclient, zoneid, ostype, services=None): list_templates = apiclient.listTemplates(cmd) - assert len(list_templates) > 0 - for template in list_templates: - if template.ostypeid == ostypeid: - return template + if isinstance(list_templates, list): + assert len(list_templates) > 0, "received empty response on template of type %s"%ostype + for template in list_templates: + if template.ostypeid == ostypeid: + return template raise Exception("Exception: Failed to find template with OSTypeID: %s" % ostypeid)
