You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/10/08 02:30:39 UTC
[08/27] libcloud git commit: and container search ;)
and container search ;)
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ce9073d4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ce9073d4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ce9073d4
Branch: refs/heads/trunk
Commit: ce9073d43a0e7426f9e444e2b47a638aac61ccbf
Parents: a58452c
Author: Mario Loria <ma...@arroyonetworks.com>
Authored: Tue Oct 4 22:06:46 2016 -0400
Committer: Anthony Shaw <an...@apache.org>
Committed: Sat Oct 8 13:29:22 2016 +1100
----------------------------------------------------------------------
libcloud/container/drivers/rancher.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ce9073d4/libcloud/container/drivers/rancher.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/rancher.py b/libcloud/container/drivers/rancher.py
index c064317..ae4d7c1 100644
--- a/libcloud/container/drivers/rancher.py
+++ b/libcloud/container/drivers/rancher.py
@@ -579,6 +579,26 @@ class RancherContainerDriver(ContainerDriver):
else:
raise RancherException(result.status, 'failed to stop container')
+ def ex_search_containers(self, search_params):
+ """
+ Search for containers matching certain filters
+
+ i.e. ``{ "imageUuid": "docker:mysql", "state": "running"}``
+
+ :param search_params: A collection of search parameters to use.
+ :type search_params: ``dict``
+
+ :rtype: ``list``
+ """
+ search_list = []
+ for f, v in search_params.items():
+ search_list.append(f + '=' + v)
+ search_items = '&'.join(search_list)
+ result = self.connection.request("%s/containers?%s" % (
+ self.baseuri, search_items)).object
+
+ return result['data']
+
def destroy_container(self, container):
"""
Remove a container