fixing broken sql server tags (#45378)

This commit is contained in:
Zim Kalinowski 2018-09-10 15:31:01 +08:00 committed by Yunge Zhu
parent d41e568a4d
commit e203531735
2 changed files with 8 additions and 0 deletions

View file

@ -163,6 +163,7 @@ class AzureRMServers(AzureRMModuleBase):
self.resource_group = None
self.name = None
self.parameters = dict()
self.tags = None
self.results = dict(changed=False)
self.state = None
@ -213,6 +214,9 @@ class AzureRMServers(AzureRMModuleBase):
self.to_do = Actions.Delete
elif self.state == 'present':
self.log("Need to check if SQL Server instance has to be deleted or may be updated")
update_tags, newtags = self.update_tags(old_response.get('tags', dict()))
if update_tags:
self.tags = newtags
self.to_do = Actions.Update
if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
@ -222,6 +226,7 @@ class AzureRMServers(AzureRMModuleBase):
self.results['changed'] = True
return self.results
self.parameters['tags'] = self.tags
response = self.create_update_sqlserver()
response.pop('administrator_login_password', None)

View file

@ -24,6 +24,8 @@
location: eastus
admin_username: mylogin
admin_password: Testpasswordxyz12!
tags:
aaa: bbb
register: output
- name: Assert the resource instance is well created
assert:
@ -64,6 +66,7 @@
- output.servers.sqlsrv{{ random_postfix }}.version != None
- output.servers.sqlsrv{{ random_postfix }}.state != None
- output.servers.sqlsrv{{ random_postfix }}.fully_qualified_domain_name != None
- output.servers.sqlsrv{{ random_postfix }}.tags.aaa == 'bbb'
- name: Gather facts SQL Server - unexisting
azure_rm_sqlserver_facts: