Skip to content
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

Merged
merged 4 commits into from
Dec 10, 2018

Conversation

dariko
Copy link
Contributor

@dariko dariko commented Nov 28, 2018

SUMMARY

This solves the idempotency issue reported in #49199, when user parameter is None

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

docker_swarm_service.py

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Nov 28, 2018

Hi @dariko, thank you for submitting this pull-request!

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 28, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. docker module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. owner_pr This PR is made by the module's maintainer. small_patch support:community This issue/PR relates to code supported by the Ansible community. labels Nov 28, 2018
@gundalow gundalow changed the title ensure idempotency when the user, publish and update_order parameter are not specified docker_swarm_service: ensure idempotency when the user, publish and update_order parameter are not specified Nov 28, 2018
@gundalow gundalow removed needs_triage Needs a first human triage before being processed. labels Nov 28, 2018
@@ -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:
Copy link
Contributor

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: []?

Copy link
Contributor Author

@dariko dariko Nov 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a change reverting problematic parts of #45674 (I've open #49285 to track the problem ) I should not have pushed this here.

I'm gonna push the correct changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok :)

@dariko dariko changed the title docker_swarm_service: ensure idempotency when the user, publish and update_order parameter are not specified docker_swarm_service: ensure idempotency when the user parameter is None Nov 29, 2018
Copy link
Contributor

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! :)

@felixfontein
Copy link
Contributor

Ah, I think you should add a little changelog. And maybe also add it to the documentation of user?

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 7, 2018
@felixfontein
Copy link
Contributor

@dariko ping

@ansibot ansibot removed owner_pr This PR is made by the module's maintainer. small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Dec 9, 2018
@dariko
Copy link
Contributor Author

dariko commented Dec 9, 2018

@felixfontein I expanded the user parameter documentation and wrote the changelog entry

Copy link
Contributor

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there :)

description: username or UID
description:
- username or UID.
- "If set to C(none) the docker daemon default value (or the one already
Copy link
Contributor

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.

Copy link
Contributor Author

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)'
Copy link
Contributor

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``' 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, thank you :)

Copy link
Contributor

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM shipit

@ansibot ansibot added shipit This PR is ready to be merged by Core and removed community_review In order to be merged, this PR must follow the community review workflow. labels Dec 9, 2018
@amenonsen amenonsen merged commit b183eb4 into ansible:devel Dec 10, 2018
@felixfontein
Copy link
Contributor

@dariko thanks for your work! Do you want to create a backport for stable-2.7?
@amenonsen thanks for merging!

@felixfontein
Copy link
Contributor

@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 :)

felixfontein pushed a commit to felixfontein/ansible that referenced this pull request Dec 10, 2018
…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)
abadger pushed a commit that referenced this pull request Dec 10, 2018
…one (#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)
@dariko
Copy link
Contributor Author

dariko commented Dec 10, 2018

@felixfontein Thank you :)

kbreit pushed a commit to kbreit/ansible that referenced this pull request Jan 11, 2019
…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
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud docker module This issue/PR relates to a module. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants