Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid the case where server returns None #718

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/modules/azure_rm_notificationhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"region": null,
"scale_unit": null,
"service_bus_endpoint": "https://testnaedd3d22d3w.servicebus.windows.net:443/",
"sku": "Free",
"sku": { "name":"Free" },
"tags": {
"a": "b"
},
Expand Down Expand Up @@ -205,7 +205,7 @@ def exec_module(self, **kwargs):
if update_tags:
changed = True
elif self.namespace_name and not self.name:
if self.sku != results['sku'].lower():
if self.sku != results['sku']['name'].lower():
changed = True

elif self.state == 'absent':
Expand Down Expand Up @@ -365,7 +365,7 @@ def namespace_to_dict(item):
type=namespace.get('type', None),
location=namespace.get(
'location', '').replace(' ', '').lower(),
sku=namespace.get("sku").get("name"),
sku=namespace.get("sku"),
tags=namespace.get('tags', None),
provisioning_state=namespace.get(
'provisioning_state', None),
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/azure_rm_notificationhub_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"region": null,
"scale_unit": null,
"service_bus_endpoint": "https://testnaedd3d22d3w.servicebus.windows.net:443/",
"sku": "Free",
"sku": {"name":"Free"},
"tags": {
"a": "b"
},
Expand Down Expand Up @@ -188,7 +188,7 @@ def namespace_to_dict(self, item):
type=namespace.get('type', None),
location=namespace.get(
'location', '').replace(' ', '').lower(),
sku=namespace.get("sku").get("name"),
sku=namespace.get("sku"),
tags=namespace.get('tags', None),
provisioning_state=namespace.get(
'provisioning_state', None),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
- assert:
that: results.changed

- name: Create Namespace Hub
azure_rm_notificationhub:
location: eastus2
namespace_name: "{{ namespace_name }}"
resource_group: "{{ resource_group }}"
sku: "free"
register: results

- assert:
that: results.changed

- name: Create Notification Hub
azure_rm_notificationhub:
location: eastus2
Expand Down Expand Up @@ -140,4 +151,3 @@

- assert:
that: not results.changed