1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudstack: add method to to get infos of API

get_capabilities() allows you to get infos e.g. `cloudstackversion`
to compare functionality of the API in your modules.
This commit is contained in:
Rene Moser 2015-04-25 18:31:58 +02:00
parent 3c0e406f5d
commit ca88189bf7

View file

@ -50,6 +50,7 @@ class AnsibleCloudStack:
self.vm = None self.vm = None
self.os_type = None self.os_type = None
self.hypervisor = None self.hypervisor = None
self.capabilities = None
def _connect(self): def _connect(self):
@ -235,6 +236,14 @@ class AnsibleCloudStack:
self.module.fail_json(msg="Hypervisor '%s' not found" % hypervisor) self.module.fail_json(msg="Hypervisor '%s' not found" % hypervisor)
def get_capabilities(self, key=None):
if self.capabilities:
return self._get_by_key(key, self.capabilities)
capabilities = self.cs.listCapabilities()
self.capabilities = capabilities['capability']
return self._get_by_key(key, self.capabilities)
def _poll_job(self, job=None, key=None): def _poll_job(self, job=None, key=None):
if 'jobid' in job: if 'jobid' in job:
while True: while True: