Fix for Azure loadbalancer tags. (#39963)
* Fix for Azure loadbalancer tags. It was possible to add tags to an Azure loadbalancer, but the tags were never set in Azure. This patch fixes that. * Pass shippable tests * azure_rm_loadbalancer_facts requires rg Getting facts of all loadbalancers via azure_rm_loadbalancer_facts requires a resource group. This fix adds the rg as parameter to the list() call. * Revert changes in azure_rm_loadbalancer_facts The changes belong to another pull request.
This commit is contained in:
parent
c84e3e70ab
commit
d25420bbb9
1 changed files with 10 additions and 1 deletions
|
@ -610,6 +610,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase):
|
|||
self.natpool_frontend_port_end = None
|
||||
self.natpool_backend_port = None
|
||||
self.natpool_protocol = None
|
||||
self.tags = None
|
||||
|
||||
self.results = dict(changed=False, state=dict())
|
||||
|
||||
|
@ -620,7 +621,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase):
|
|||
|
||||
def exec_module(self, **kwargs):
|
||||
"""Main module execution method"""
|
||||
for key in self.module_args.keys():
|
||||
for key in list(self.module_args.keys()) + ['tags']:
|
||||
setattr(self, key, kwargs[key])
|
||||
|
||||
changed = False
|
||||
|
@ -685,6 +686,13 @@ class AzureRMLoadBalancer(AzureRMModuleBase):
|
|||
changed = True
|
||||
|
||||
self.results['state'] = load_balancer_to_dict(load_balancer)
|
||||
if 'tags' in self.results['state']:
|
||||
update_tags, self.results['state']['tags'] = self.update_tags(self.results['state']['tags'])
|
||||
if update_tags:
|
||||
changed = True
|
||||
else:
|
||||
if self.tags:
|
||||
changed = True
|
||||
self.results['changed'] = changed
|
||||
|
||||
if self.state == 'present' and changed:
|
||||
|
@ -761,6 +769,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase):
|
|||
param = self.network_models.LoadBalancer(
|
||||
sku=self.network_models.LoadBalancerSku(self.sku) if self.sku else None,
|
||||
location=self.location,
|
||||
tags=self.tags,
|
||||
frontend_ip_configurations=frontend_ip_configurations_param,
|
||||
backend_address_pools=backend_address_pools_param,
|
||||
probes=probes_param,
|
||||
|
|
Loading…
Reference in a new issue