1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

View file

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