From 6a3a139846fd2c05b2ac910f2c658e3713bc82c2 Mon Sep 17 00:00:00 2001 From: Eldar Nugaev Date: Mon, 30 May 2011 14:31:56 +0400 Subject: [PATCH] Added parameter detailed to list --- novaclient/flavors.py | 15 +++++---------- novaclient/images.py | 8 ++++++-- novaclient/ipgroups.py | 7 +++++-- novaclient/servers.py | 8 ++++++-- novaclient/zones.py | 7 +++++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/novaclient/flavors.py b/novaclient/flavors.py index cf60c602c..7004b73ec 100644 --- a/novaclient/flavors.py +++ b/novaclient/flavors.py @@ -21,21 +21,16 @@ class FlavorManager(base.ManagerWithFind): """ resource_class = Flavor - def list(self): + def list(self, detailed=False): """ Get a list of all flavors. :rtype: list of :class:`Flavor`. """ - return self._list("/flavors/detail", "flavors") - - def list_undetailed(self): - """ - Get a list of all flavors. - - :rtype: list of :class:`Flavor`. - """ - return self._list("/flavors", "flavors") + detail = "" + if detailed: + detail = "/detail" + return self._list("/flavors%s" % detail, "flavors") def get(self, flavor): """ diff --git a/novaclient/images.py b/novaclient/images.py index b5e01987d..56333bb1d 100644 --- a/novaclient/images.py +++ b/novaclient/images.py @@ -35,13 +35,17 @@ class ImageManager(base.ManagerWithFind): """ return self._get("/images/%s" % base.getid(image), "image") - def list(self): + def list(self, detailed=False): """ Get a list of all images. :rtype: list of :class:`Image` """ - return self._list("/images/detail", "images") + detail = "" + if detailed: + detail = "/detail" + return self._list("/images%s" % detail, "images") + def create(self, name, server): """ diff --git a/novaclient/ipgroups.py b/novaclient/ipgroups.py index ee0294767..29edf1337 100644 --- a/novaclient/ipgroups.py +++ b/novaclient/ipgroups.py @@ -20,13 +20,16 @@ class IPGroup(base.Resource): class IPGroupManager(base.ManagerWithFind): resource_class = IPGroup - def list(self): + def list(self, detailed=False): """ Get a list of all groups. :rtype: list of :class:`IPGroup` """ - return self._list("/shared_ip_groups/detail", "sharedIpGroups") + detail = "" + if detailed: + detail = "/detail" + return self._list("/shared_ip_groups%s" % s, "sharedIpGroups") def get(self, group): """ diff --git a/novaclient/servers.py b/novaclient/servers.py index 9b0a41580..50a51031c 100644 --- a/novaclient/servers.py +++ b/novaclient/servers.py @@ -187,12 +187,16 @@ class ServerManager(base.ManagerWithFind): """ return self._get("/servers/%s" % base.getid(server), "server") - def list(self): + def list(self, detailed=False): """ Get a list of servers. :rtype: list of :class:`Server` """ - return self._list("/servers/detail", "servers") + detail = "" + if detailed: + detail = "/detail" + return self._list("/servers%s" % detail, "servers") + def create(self, name, image, flavor, ipgroup=None, meta=None, files=None): """ diff --git a/novaclient/zones.py b/novaclient/zones.py index 567c3de8d..69bc72d94 100644 --- a/novaclient/zones.py +++ b/novaclient/zones.py @@ -67,12 +67,15 @@ class ZoneManager(base.ManagerWithFind): """ return self._get("/zones/%s" % base.getid(zone), "zone") - def list(self): + def list(self, detailed=False): """ Get a list of child zones. :rtype: list of :class:`Zone` """ - return self._list("/zones/detail", "zones") + detail = "" + if detailed: + detail = "/detail" + return self._list("/zones%s" % detail, "zones") def create(self, api_url, username, password): """