Skip to content

Commit

Permalink
bugfix for azure_rm_managementgroup_info module, subscriptions not de…
Browse files Browse the repository at this point in the history
…tected as correct type (ansible-collections#630)

* updates ready for review

* undisable the management group test

* Update tests/integration/targets/azure_rm_managementgroup/aliases

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
  • Loading branch information
2 people authored and nbr23 committed Oct 26, 2021
1 parent aae2f51 commit a90eac9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ tests/staging/
tests/integration/cloud-config-azure.ini
azure-azcollection-*.tar.gz
venv*
.venv*
.vscode
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_managementgroup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def to_dict(self, azure_object):
name=parent_dict.get('name')
)

elif azure_object.type == 'asdfasdf/subscriptions':
elif azure_object.type == '/subscriptions':
return_dict = dict(
display_name=azure_object.display_name,
id=azure_object.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
recurse: True
flatten: True
children: True
register: az_recursive_managementgroups

- name: Get a managementgroup by name
azure_rm_managementgroup_info:
Expand All @@ -22,7 +23,13 @@
register: invalid_name
ignore_errors: yes

- name: Assert task failed
- name: Validate expected states
assert:
that:
- invalid_name['failed']

- name: Validate expected attributes
assert:
that:
- "{{ item.id is defined }}"
loop: "{{ az_recursive_managementgroups.management_groups + az_recursive_managementgroups.subscriptions }}"

0 comments on commit a90eac9

Please sign in to comment.