-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker_swarm_service: ensure idempotency when the user parameter is None #49235
Conversation
Hi @dariko, thank you for submitting this pull-request! |
@@ -696,7 +696,7 @@ def compare(self, os): | |||
differences.add('reserve_memory', parameter=self.reserve_memory, active=os.reserve_memory) | |||
if self.container_labels != os.container_labels: | |||
differences.add('container_labels', parameter=self.container_labels, active=os.container_labels) | |||
if self.publish != os.publish: | |||
if self.publish and self.publish != os.publish: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you handle publish
this way? If a user explicitly specifies publish: []
, why should it behave differently than, for example, if the user explicitly specifies networks: []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok :)
ce6a1c7
to
b2ce9c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! :)
Ah, I think you should add a little changelog. And maybe also add it to the documentation of |
@dariko ping |
b2ce9c5
to
e178242
Compare
e178242
to
b2e7fa8
Compare
@felixfontein I expanded the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :)
changelogs/fragments/49235-docker_swarm_service-user-default.yaml
Outdated
Show resolved
Hide resolved
description: username or UID | ||
description: | ||
- username or UID. | ||
- "If set to C(none) the docker daemon default value (or the one already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value must be null
(that's YAML's None
), not none
. It might be that Ansible does some magic to also convert "none"
to None
, but I guess it's safer to use the correct YAML keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I also wrote the same value in the changelog fragment.
minor_changes: | ||
- 'docker_swarm_service: use docker defaults for the C(user) parameter if it is set to None' | ||
- 'docker_swarm_service: use docker defaults for the C(user) parameter if it is set to C(null)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry for not noticing it earlier, but here you have to use ReST syntax, i.e.
- 'docker_swarm_service: use docker defaults for the ``user`` parameter if it is set to ``null``'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM shipit
@dariko thanks for your work! Do you want to create a backport for stable-2.7? |
@dariko There's a merge window for 2.7.5 which ends today; I'll simply create a backport. I hope that's ok for you :) |
…one (ansible#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 b183eb4)
@felixfontein Thank you :) |
…one (ansible#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
SUMMARY
This solves the idempotency issue reported in #49199, when
user
parameter isNone
ISSUE TYPE
COMPONENT NAME
docker_swarm_service.py
ADDITIONAL INFORMATION