Updated Branches: refs/heads/trunk c235553c7 -> dbe5259ae
Modify ex_list_networks methods in CloudStack driver to not thrown if there are no networks available. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/dbe5259a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/dbe5259a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/dbe5259a Branch: refs/heads/trunk Commit: dbe5259ae550a9ae6b0104531d73c23d79195f58 Parents: c235553 Author: Tomaz Muraus <[email protected]> Authored: Thu Dec 12 21:10:57 2013 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Thu Dec 12 21:10:57 2013 +0100 ---------------------------------------------------------------------- CHANGES | 4 ++++ libcloud/compute/drivers/cloudstack.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/dbe5259a/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index f534fcd..b5bce5e 100644 --- a/CHANGES +++ b/CHANGES @@ -66,6 +66,10 @@ Changes with Apache Libcloud in development instead of a generic Exception. [Tomaz Muraus] + - Modify ex_list_networks methods in CloudStack driver to not thrown if there + are no networks available. + [Tomaz Muraus] + *) Storage - Allow user to specify 'Content-Disposition' header in the CloudFiles http://git-wip-us.apache.org/repos/asf/libcloud/blob/dbe5259a/libcloud/compute/drivers/cloudstack.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py index 98a06ee..36dc37a 100644 --- a/libcloud/compute/drivers/cloudstack.py +++ b/libcloud/compute/drivers/cloudstack.py @@ -545,8 +545,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): :rtype ``list`` of :class:`CloudStackNetwork` """ - nets = self._sync_request(command='listNetworks', - method='GET')['network'] + res = self._sync_request(command='listNetworks', + method='GET') + nets = res.get('network', []) networks = [] for net in nets:
