Skip to content

Commit

Permalink
cloud: ovirt: Add support to list nested entities parameters (ansible…
Browse files Browse the repository at this point in the history
  • Loading branch information
machacekondra authored and ryansb committed Dec 14, 2016
1 parent 59227d8 commit fa96438
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 17 deletions.
21 changes: 18 additions & 3 deletions lib/ansible/module_utils/ovirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,12 @@ def create(self, entity=None, result_state=None, fail_condition=lambda e: False,
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):
Expand Down Expand Up @@ -512,7 +517,12 @@ def remove(self, entity=None, search_params=None, **kwargs):
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(
Expand Down Expand Up @@ -582,7 +592,12 @@ def action(
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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_clusters_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_datacenters_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_groups_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_hosts_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_networks_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_nics_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_quotas_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_templates_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_users_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_vmpools_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down
7 changes: 6 additions & 1 deletion lib/ansible/modules/cloud/ovirt/ovirt_vms_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
),
)
Expand Down

0 comments on commit fa96438

Please sign in to comment.