~corey.bryant/python-novaclient/2.26.0

« back to all changes in this revision

Viewing changes to novaclient/v3/hosts.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-09-18 08:52:31 UTC
  • mfrom: (1.1.35)
  • Revision ID: package-import@ubuntu.com-20140918085231-56hs515gp9zpb9sd
Tags: 1:2.19.0-0ubuntu1
* New upstream release.
* debian/control: Drop python-d2to1, python-httpretty as build dependency.
* debian/control: Add python-requests-mock as build dependency.
* debian/control: Add python-oslo.utils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        """Perform an action on a host."""
34
34
        url = '/os-hosts/{0}/{1}'.format(host, action)
35
35
        return self._get(url, response_key='host')
 
36
 
 
37
    def list(self, zone=None, service=None):
 
38
        """List cloud hosts."""
 
39
 
 
40
        filters = []
 
41
        if zone:
 
42
            filters.append('zone=%s' % zone)
 
43
        if service:
 
44
            filters.append('service=%s' % service)
 
45
 
 
46
        if filters:
 
47
            url = '/os-hosts?%s' % '&'.join(filters)
 
48
        else:
 
49
            url = '/os-hosts'
 
50
 
 
51
        return self._list(url, "hosts")