docker_volume: revert #47390 (#50663)

* Revert "Fix option change detection / force support for docker_volume. (#47390)"

This reverts commit 8ef994fbc5.

* Update changelog.

* Adjusting tests.
pull/47809/head
Felix Fontein 6 years ago committed by Adam Miller
parent fd56788a14
commit 0e7a9a2771

@ -0,0 +1,4 @@
minor_changes:
- "docker_volume - reverted changed behavior of ``force``, which was released in Ansible 2.7.1 to 2.7.5, and Ansible 2.6.8 to 2.6.11.
Volumes are now only recreated if the parameters changed **and** ``force`` is set to ``true`` (instead of or). This is the behavior
which has been described in the documentation all the time."

@ -249,7 +249,7 @@ class DockerVolumeManager(object):
differences = self.has_different_config() differences = self.has_different_config()
self.diff_tracker.add('exists', parameter=True, active=self.existing_volume is not None) self.diff_tracker.add('exists', parameter=True, active=self.existing_volume is not None)
if not differences.empty or self.parameters.force: if not differences.empty and self.parameters.force:
self.remove_volume() self.remove_volume()
self.existing_volume = None self.existing_volume = None

@ -42,7 +42,7 @@
that: that:
- create_1 is changed - create_1 is changed
- create_2 is not changed - create_2 is not changed
- create_3 is changed - create_3 is not changed
- absent_1 is changed - absent_1 is changed
- absent_2 is not changed - absent_2 is not changed
@ -80,6 +80,17 @@
o: size=200m,uid=1000 o: size=200m,uid=1000
register: driver_options_3 register: driver_options_3
- name: Create a volume with options (changed, force)
docker_volume:
name: "{{ vname }}"
driver: local
driver_options:
type: tempfs
device: tmpfs
o: size=200m,uid=1000
force: yes
register: driver_options_4
- name: Cleanup - name: Cleanup
docker_volume: docker_volume:
name: "{{ vname }}" name: "{{ vname }}"
@ -89,7 +100,8 @@
that: that:
- driver_options_1 is changed - driver_options_1 is changed
- driver_options_2 is not changed - driver_options_2 is not changed
- driver_options_3 is changed - driver_options_3 is not changed
- driver_options_4 is changed
#################################################################### ####################################################################
## labels ########################################################## ## labels ##########################################################
@ -118,13 +130,30 @@
ansible.test.1: hello ansible.test.1: hello
register: driver_labels_3 register: driver_labels_3
- name: Create a volume with labels (less, force)
docker_volume:
name: "{{ vname }}"
labels:
ansible.test.1: hello
force: yes
register: driver_labels_4
- name: Create a volume with labels (more) - name: Create a volume with labels (more)
docker_volume: docker_volume:
name: "{{ vname }}" name: "{{ vname }}"
labels: labels:
ansible.test.1: hello ansible.test.1: hello
ansible.test.3: ansible ansible.test.3: ansible
register: driver_labels_4 register: driver_labels_5
- name: Create a volume with labels (more, force)
docker_volume:
name: "{{ vname }}"
labels:
ansible.test.1: hello
ansible.test.3: ansible
force: yes
register: driver_labels_6
- name: Cleanup - name: Cleanup
docker_volume: docker_volume:
@ -136,4 +165,6 @@
- driver_labels_1 is changed - driver_labels_1 is changed
- driver_labels_2 is not changed - driver_labels_2 is not changed
- driver_labels_3 is not changed - driver_labels_3 is not changed
- driver_labels_4 is changed - driver_labels_4 is not changed
- driver_labels_5 is not changed
- driver_labels_6 is changed

Loading…
Cancel
Save