From bf85d0662705da00dae2be1b2635492cec81ed2d Mon Sep 17 00:00:00 2001 From: James Mighion Date: Tue, 12 Dec 2023 11:03:36 -0800 Subject: [PATCH 1/5] Adding tags to the azure_rm_appgateway module. --- plugins/modules/azure_rm_appgateway.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/modules/azure_rm_appgateway.py b/plugins/modules/azure_rm_appgateway.py index f95766fa9..36726cfb5 100644 --- a/plugins/modules/azure_rm_appgateway.py +++ b/plugins/modules/azure_rm_appgateway.py @@ -1854,6 +1854,9 @@ def __init__(self): type='str', default='present', choices=['present', 'absent'] + ), + tags=dict( + type='dict' ) ) @@ -2239,6 +2242,8 @@ def exec_module(self, **kwargs): self.parameters["web_application_firewall_configuration"] = kwargs[key] elif key == "enable_http2": self.parameters["enable_http2"] = kwargs[key] + elif key == "tags": + self.parameters["tags"] = kwargs[key] response = None @@ -2291,7 +2296,8 @@ def exec_module(self, **kwargs): not compare_arrays(old_response, self.parameters, 'url_path_maps') or not compare_arrays(old_response, self.parameters, 'trusted_root_certificates') or not compare_dicts(old_response, self.parameters, 'autoscale_configuration') or - not compare_dicts(old_response, self.parameters, 'web_application_firewall_configuration')): + not compare_dicts(old_response, self.parameters, 'web_application_firewall_configuration') or + not compare_dicts(old_response, self.parameters, 'tags')): self.to_do = Actions.Update else: self.to_do = Actions.NoAction From 233ad46708711abeed2e2b67a23e986932788e8f Mon Sep 17 00:00:00 2001 From: James Mighion Date: Wed, 13 Dec 2023 07:20:46 -0800 Subject: [PATCH 2/5] Removing unnecessary tags from module_arg_spec. --- plugins/modules/azure_rm_appgateway.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/modules/azure_rm_appgateway.py b/plugins/modules/azure_rm_appgateway.py index 36726cfb5..0472af86e 100644 --- a/plugins/modules/azure_rm_appgateway.py +++ b/plugins/modules/azure_rm_appgateway.py @@ -1854,9 +1854,6 @@ def __init__(self): type='str', default='present', choices=['present', 'absent'] - ), - tags=dict( - type='dict' ) ) From 3f6874fab4c70f39fcb71ca6b41f5ed8e50ea680 Mon Sep 17 00:00:00 2001 From: James Mighion Date: Thu, 25 Jan 2024 11:26:24 -0800 Subject: [PATCH 3/5] Separate conditional for tag update. --- plugins/modules/azure_rm_appgateway.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/modules/azure_rm_appgateway.py b/plugins/modules/azure_rm_appgateway.py index 0472af86e..7170a8c1b 100644 --- a/plugins/modules/azure_rm_appgateway.py +++ b/plugins/modules/azure_rm_appgateway.py @@ -2293,12 +2293,16 @@ def exec_module(self, **kwargs): not compare_arrays(old_response, self.parameters, 'url_path_maps') or not compare_arrays(old_response, self.parameters, 'trusted_root_certificates') or not compare_dicts(old_response, self.parameters, 'autoscale_configuration') or - not compare_dicts(old_response, self.parameters, 'web_application_firewall_configuration') or - not compare_dicts(old_response, self.parameters, 'tags')): + not compare_dicts(old_response, self.parameters, 'web_application_firewall_configuration'): self.to_do = Actions.Update else: self.to_do = Actions.NoAction + update_tags, new_tags = self.update_tags(old_response['tags']) + if update_tags: + self.to_do = Actions.Update + self.parameters["tags"] = new_tags + if (self.to_do == Actions.Create) or (self.to_do == Actions.Update): self.log("Need to Create / Update the Application Gateway instance") From 8f7e869df0cc97b18725a87661ea6be388d80c61 Mon Sep 17 00:00:00 2001 From: James Mighion Date: Fri, 26 Jan 2024 08:16:48 -0800 Subject: [PATCH 4/5] Missing parenthesis. --- plugins/modules/azure_rm_appgateway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/azure_rm_appgateway.py b/plugins/modules/azure_rm_appgateway.py index 7170a8c1b..7e48ddf01 100644 --- a/plugins/modules/azure_rm_appgateway.py +++ b/plugins/modules/azure_rm_appgateway.py @@ -2293,7 +2293,7 @@ def exec_module(self, **kwargs): not compare_arrays(old_response, self.parameters, 'url_path_maps') or not compare_arrays(old_response, self.parameters, 'trusted_root_certificates') or not compare_dicts(old_response, self.parameters, 'autoscale_configuration') or - not compare_dicts(old_response, self.parameters, 'web_application_firewall_configuration'): + not compare_dicts(old_response, self.parameters, 'web_application_firewall_configuration')): self.to_do = Actions.Update else: self.to_do = Actions.NoAction From ffc4812e4fea0e83d705154f64c77ab61345ead1 Mon Sep 17 00:00:00 2001 From: James Mighion Date: Tue, 30 Jan 2024 07:04:36 -0800 Subject: [PATCH 5/5] Moving conditional under another. --- plugins/modules/azure_rm_appgateway.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/azure_rm_appgateway.py b/plugins/modules/azure_rm_appgateway.py index 7e48ddf01..415a2a836 100644 --- a/plugins/modules/azure_rm_appgateway.py +++ b/plugins/modules/azure_rm_appgateway.py @@ -2298,10 +2298,10 @@ def exec_module(self, **kwargs): else: self.to_do = Actions.NoAction - update_tags, new_tags = self.update_tags(old_response['tags']) - if update_tags: - self.to_do = Actions.Update - self.parameters["tags"] = new_tags + update_tags, new_tags = self.update_tags(old_response['tags']) + if update_tags: + self.to_do = Actions.Update + self.parameters["tags"] = new_tags if (self.to_do == Actions.Create) or (self.to_do == Actions.Update): self.log("Need to Create / Update the Application Gateway instance")