fixing force_update in azure_rm_mysqldatabase (#52389)
(cherry picked from commit fa73abcf5d
)
This commit is contained in:
parent
474d76c0dd
commit
211fe600a4
3 changed files with 37 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- azure_rm_postgresqldatabase - fix force_update bug.
|
|
@ -145,6 +145,7 @@ class AzureRMDatabases(AzureRMModuleBase):
|
||||||
self.resource_group = None
|
self.resource_group = None
|
||||||
self.server_name = None
|
self.server_name = None
|
||||||
self.name = None
|
self.name = None
|
||||||
|
self.force_update = None
|
||||||
self.parameters = dict()
|
self.parameters = dict()
|
||||||
|
|
||||||
self.results = dict(changed=False)
|
self.results = dict(changed=False)
|
||||||
|
@ -199,6 +200,7 @@ class AzureRMDatabases(AzureRMModuleBase):
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
self.delete_mysqldatabase()
|
self.delete_mysqldatabase()
|
||||||
else:
|
else:
|
||||||
|
self.fail("Database properties cannot be updated without setting 'force_update' option")
|
||||||
self.to_do = Actions.NoAction
|
self.to_do = Actions.NoAction
|
||||||
|
|
||||||
if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
|
if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
|
||||||
|
|
|
@ -176,6 +176,8 @@
|
||||||
resource_group: "{{ resource_group }}"
|
resource_group: "{{ resource_group }}"
|
||||||
server_name: mysqlsrv{{ rpfx }}
|
server_name: mysqlsrv{{ rpfx }}
|
||||||
name: testdatabase
|
name: testdatabase
|
||||||
|
collation: latin1_swedish_ci
|
||||||
|
charset: latin1
|
||||||
register: output
|
register: output
|
||||||
- name: Assert the resource instance is well created
|
- name: Assert the resource instance is well created
|
||||||
assert:
|
assert:
|
||||||
|
@ -188,6 +190,8 @@
|
||||||
resource_group: "{{ resource_group }}"
|
resource_group: "{{ resource_group }}"
|
||||||
server_name: mysqlsrv{{ rpfx }}
|
server_name: mysqlsrv{{ rpfx }}
|
||||||
name: testdatabase
|
name: testdatabase
|
||||||
|
collation: latin1_swedish_ci
|
||||||
|
charset: latin1
|
||||||
register: output
|
register: output
|
||||||
- name: Assert the state has not changed
|
- name: Assert the state has not changed
|
||||||
assert:
|
assert:
|
||||||
|
@ -195,6 +199,35 @@
|
||||||
- output.changed == false
|
- output.changed == false
|
||||||
- output.name == 'testdatabase'
|
- output.name == 'testdatabase'
|
||||||
|
|
||||||
|
- name: Try to update database without force_update
|
||||||
|
azure_rm_mysqldatabase:
|
||||||
|
resource_group: "{{ resource_group }}"
|
||||||
|
server_name: mysqlsrv{{ rpfx }}
|
||||||
|
name: testdatabase
|
||||||
|
collation: latin1_czech_ci
|
||||||
|
charset: latin1
|
||||||
|
ignore_errors: yes
|
||||||
|
register: output
|
||||||
|
- name: Assert that nothing has changed
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- output.changed == False
|
||||||
|
|
||||||
|
- name: Update instance of database using force_update
|
||||||
|
azure_rm_mysqldatabase:
|
||||||
|
resource_group: "{{ resource_group }}"
|
||||||
|
server_name: mysqlsrv{{ rpfx }}
|
||||||
|
name: testdatabase
|
||||||
|
collation: latin1_czech_ci
|
||||||
|
charset: latin1
|
||||||
|
force_update: yes
|
||||||
|
register: output
|
||||||
|
- name: Assert the state has changed
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- output.changed
|
||||||
|
- output.name == 'testdatabase'
|
||||||
|
|
||||||
- name: Create second instance of MySQL Database
|
- name: Create second instance of MySQL Database
|
||||||
azure_rm_mysqldatabase:
|
azure_rm_mysqldatabase:
|
||||||
resource_group: "{{ resource_group }}"
|
resource_group: "{{ resource_group }}"
|
||||||
|
|
Loading…
Reference in a new issue