docker_swarm_service: ensure idempotency when the user parameter is None (#49235)

* ensure idempotency for user set to None

* Update `user` documentation and add changelog fragment

* clarify changelog fragments and parameters documentation

* use restructuredtext syntax in changelog fragment

(cherry picked from commit b183eb4464)
This commit is contained in:
Dario Zanzico 2018-12-10 09:39:13 +01:00 committed by Toshio Kuratomi
parent 291c9388ea
commit 961382bf5e
2 changed files with 10 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
bugfixes:
- 'docker_swarm_service: fails because of default "user: root" (https://github.com/ansible/ansible/issues/49199)'
minor_changes:
- 'docker_swarm_service: use docker defaults for the ``user`` parameter if it is set to ``null``'

View file

@ -273,7 +273,10 @@ options:
user:
required: false
default: root
description: username or UID
description:
- username or UID.
- "If set to C(null) the image provided value (or the one already
set for the service) will be used"
extends_documentation_fragment:
- docker
requirements:
@ -718,7 +721,7 @@ class DockerService(DockerBaseClass):
differences.append('update_order')
if self.image != os.image.split('@')[0]:
differences.append('image')
if self.user != os.user:
if self.user and self.user != os.user:
differences.append('user')
if self.dns != os.dns:
differences.append('dns')