cloud: ovirt: Add support to list nested entities parameters (#19300)

This commit is contained in:
Ondra Machacek 2016-12-14 17:15:50 +01:00 committed by Ryan Brown
parent 59227d8c31
commit fa96438f4c
15 changed files with 102 additions and 17 deletions

View file

@ -460,7 +460,12 @@ class BaseModule(object):
return {
'changed': self.changed,
'id': entity.id,
type(entity).__name__.lower(): get_dict_of_struct(entity),
type(entity).__name__.lower(): get_dict_of_struct(
struct=entity,
connection=self._connection,
fetch_nested=self._module.params.get('fetch_nested'),
attributes=self._module.params.get('nested_attributes'),
),
}
def pre_remove(self, entity):
@ -512,7 +517,12 @@ class BaseModule(object):
return {
'changed': self.changed,
'id': entity.id,
type(entity).__name__.lower(): get_dict_of_struct(entity),
type(entity).__name__.lower(): get_dict_of_struct(
struct=entity,
connection=self._connection,
fetch_nested=self._module.params.get('fetch_nested'),
attributes=self._module.params.get('nested_attributes'),
),
}
def action(
@ -582,7 +592,12 @@ class BaseModule(object):
return {
'changed': self.changed,
'id': entity.id,
type(entity).__name__.lower(): get_dict_of_struct(entity),
type(entity).__name__.lower(): get_dict_of_struct(
struct=entity,
connection=self._connection,
fetch_nested=self._module.params.get('fetch_nested'),
attributes=self._module.params.get('nested_attributes'),
),
}
def search_entity(self, search_params=None):

View file

@ -144,7 +144,12 @@ def main():
changed=False,
ansible_facts=dict(
affinity_labels=[
get_dict_of_struct(l) for l in labels
get_dict_of_struct(
struct=l,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for l in labels
],
),
)

View file

@ -89,7 +89,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_clusters=[
get_dict_of_struct(c) for c in clusters
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in clusters
],
),
)

View file

@ -88,7 +88,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_datacenters=[
get_dict_of_struct(c) for c in datacenters
get_dict_of_struct(
struct=d,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for d in datacenters
],
),
)

View file

@ -137,7 +137,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_external_providers=[
get_dict_of_struct(c) for c in external_providers
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in external_providers
],
),
)

View file

@ -88,7 +88,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_groups=[
get_dict_of_struct(c) for c in groups
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in groups
],
),
)

View file

@ -87,7 +87,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_hosts=[
get_dict_of_struct(c) for c in hosts
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in hosts
],
),
)

View file

@ -90,7 +90,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_networks=[
get_dict_of_struct(c) for c in networks
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in networks
],
),
)

View file

@ -108,7 +108,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_nics=[
get_dict_of_struct(c) for c in nics
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in nics
],
),
)

View file

@ -107,7 +107,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_quotas=[
get_dict_of_struct(c) for c in quotas
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in quotas
],
),
)

View file

@ -90,7 +90,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_storage_domains=[
get_dict_of_struct(c) for c in storage_domains
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in storage_domains
],
),
)

View file

@ -90,7 +90,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_templates=[
get_dict_of_struct(c) for c in templates
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in templates
],
),
)

View file

@ -88,7 +88,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_users=[
get_dict_of_struct(c) for c in users
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in users
],
),
)

View file

@ -88,7 +88,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_vm_pools=[
get_dict_of_struct(c) for c in vmpools
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in vmpools
],
),
)

View file

@ -90,7 +90,12 @@ def main():
changed=False,
ansible_facts=dict(
ovirt_vms=[
get_dict_of_struct(c) for c in vms
get_dict_of_struct(
struct=c,
connection=connection,
fetch_nested=module.params.get('fetch_nested'),
attributes=module.params.get('nested_attributes'),
) for c in vms
],
),
)