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

clarify port.mode paramter requiremets, fail if unmet #47938

Conversation

dariko
Copy link
Contributor

@dariko dariko commented Nov 1, 2018

Fixes #47737

Docker python library supports enpointspec.publishmode only since version 3.0.0, and ignores it in previous releases publishing the port via vip.

This PR clarifies the documentation and has the module fail if the publish.mode parameter is used with a docker python library version <3.0.0

@ansibot
Copy link
Contributor

ansibot commented Nov 1, 2018

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

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 1, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 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. support:community This issue/PR relates to code supported by the Ansible community. labels Nov 1, 2018
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Nov 1, 2018
@@ -457,7 +457,7 @@
import time
from ansible.module_utils.docker_common import DockerBaseClass
from ansible.module_utils.docker_common import AnsibleDockerClient
from ansible.module_utils.docker_common import HAS_DOCKER_PY_3
from module_utils.docker_common import docker_version
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, I think it also needs ansible. (as all the others). I wrote that down from my head, and it looks like I forgot something :)

Also, why don't you combine the above lines to:

from ansible.module_utils.docker_common import (
    DockerBaseClass, AnsibleDockerClient, docker_version,
)

Copy link
Contributor

Choose a reason for hiding this comment

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

(Combining them is a matter of style, so feel free to ignore that :) It just came to my mind when I saw the lines...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right... this time I tested it before pushing 😄
I simply didn't know that syntax, It's definitely better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like CI does not like that syntax, it's throwing this error

02:49 Run command: /usr/bin/python test/sanity/validate-modules/validate-modules --format json --arg-spec lib/ansible/modules/cloud/docker/docker_swarm_service.py --base-branch origin/devel
02:50 ERROR: Found 1 validate-modules issue(s) which need to be resolved:
02:50 ERROR: lib/ansible/modules/cloud/docker/docker_swarm_service.py:0:0: E321 Exception attempting to import module for argument_spec introspection, 'cannot import name 'docker_version'' (75%)

I'll go back to the more extensive form

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is unrelated to this change, it was already caused by the change before (using docker_version instead of HAS_DOCKER_PY_3). But that can be easily fixed by setting docker_version to None if docker-py cannot be imported (see my comment below).

@@ -0,0 +1,2 @@
minor_changes:
Copy link
Contributor

Choose a reason for hiding this comment

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

How about making this a bugfix (i.e. bugfixes:)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a bugfix or a minor change and a bugfix?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would make it simply a bugfix. And maybe also add that the parameter was simply ignored for that docker-py version before this fix. (I can't really think of any reason why the old behavior would have been useful...)

@dariko dariko force-pushed the docker_swarm_service_clarify_publish_requirements branch from 7590f7c to ce6f74c Compare November 1, 2018 20:43
@felixfontein
Copy link
Contributor

About the failing tests: the problem is that docker_version is not defined when docker-py is not available. This would have been fixed in #46527, but that didn't got merged so far (some changes are pending). You can copy the docker_common.py changes from that PR over into your PR (it's only one non-empty line), that should fix the problem.

@ansibot
Copy link
Contributor

ansibot commented Nov 1, 2018

The test ansible-test sanity --test import --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:458:0: ImportError: cannot import name docker_version

The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:458:0: ImportError: cannot import name docker_version

The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:458:0: ImportError: cannot import name 'docker_version'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:458:0: ImportError: cannot import name 'docker_version'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:458:0: ImportError: cannot import name 'docker_version' from 'ansible.module_utils.docker_common' (/root/ansible/test/runner/.tox/import/lib/ansible/module_utils/docker_common.py)

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:0:0: E321 Exception attempting to import module for argument_spec introspection, 'cannot import name 'docker_version''

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Nov 1, 2018
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Nov 1, 2018
@ansibot
Copy link
Contributor

ansibot commented Nov 1, 2018

The test ansible-test sanity --test import --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:460:0: ImportError: cannot import name docker_version

The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:460:0: ImportError: cannot import name docker_version

The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:460:0: ImportError: cannot import name 'docker_version'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:460:0: ImportError: cannot import name 'docker_version'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:460:0: ImportError: cannot import name 'docker_version' from 'ansible.module_utils.docker_common' (/root/ansible/test/runner/.tox/import/lib/ansible/module_utils/docker_common.py)

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_swarm_service.py:0:0: E321 Exception attempting to import module for argument_spec introspection, 'cannot import name 'docker_version''

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Nov 1, 2018
@felixfontein
Copy link
Contributor

@dariko now that #46527 has been merged, can you remove the rollback commit and rebase against devel? I think it should then work.

@felixfontein
Copy link
Contributor

@dariko if this should go into Ansible 2.7.2, we should have it merged and a backport ready until upcoming Monday.

@ansibot
Copy link
Contributor

ansibot commented Nov 10, 2018

@dariko this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 10, 2018

@dariko This PR was evaluated as a potentially problematic PR for the following reasons:

  • More than 50 changed files.
  • More than 50 commits.

Such PR can only be merged by human. Contact a Core team member to review this PR on IRC: #ansible-devel on irc.freenode.net

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! and removed ci_verified Changes made in this PR are causing tests to fail. labels Nov 10, 2018
Co-Authored-By: dariko <dariko@users.noreply.github.com>
@dariko dariko force-pushed the docker_swarm_service_clarify_publish_requirements branch from 3293cd7 to 750a3e7 Compare November 10, 2018 07:01
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Nov 10, 2018
@dariko
Copy link
Contributor Author

dariko commented Nov 10, 2018

@felixfontein I rebased to devel, now the the tests run without errors, I can open a backport PR as soon as this is merged.

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.

shitip

@felixfontein
Copy link
Contributor

@dariko the backport should probably include #46527 (i.e. cherry-pick both merge commits from that PR and this PR).

@felixfontein
Copy link
Contributor

shipit

@felixfontein
Copy link
Contributor

shitip

typo of the year... :D

@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 Nov 10, 2018
@dariko
Copy link
Contributor Author

dariko commented Nov 10, 2018

@felixfontein Yes, otherwise the tests will fail; I'll cherry-pick this PR merge commit and c062f37

@gundalow gundalow merged commit 89bcd3f into ansible:devel Nov 12, 2018
@gundalow
Copy link
Contributor

@dariko Thank you for the PR
@felixfontein Thank you for the review

Merged into devel

@felixfontein
Copy link
Contributor

@dariko do you have time to do the backport today? If not, I can also do it this evening.

dariko added a commit to dariko/ansible that referenced this pull request Nov 12, 2018
* clarify port.mode paramter requiremets, fail if unmet

* changelog fragment

* shorten too long line

* remove unnecessary indentation

* test version on docker_version for better maintainability

* normalize imports

* changelog fragment: minor_changes -> bugfixes

* rollback e96a7e57dfefd566fa47cf465a759637affd4795

* typo

Co-Authored-By: dariko <dariko@users.noreply.github.com>

(cherry picked from commit 89bcd3f)
@dariko dariko mentioned this pull request Nov 12, 2018
@dariko
Copy link
Contributor Author

dariko commented Nov 12, 2018

@felixfontein thank you for everything :) I created the backport PR #48565; I never opened a backport PR before.. I hope it is all right.
@gundalow thank you for merging

@felixfontein
Copy link
Contributor

@dariko you're welcome! Creating a backport is usually pretty simple, after a few times you usually even remember the branch name format (took me some more times I think ;) ).

@gundalow
Copy link
Contributor

@dariko
Copy link
Contributor Author

dariko commented Nov 12, 2018

@gundalow thank you, that's the guide i followed!

Ghilli3 pushed a commit to Ghilli3/ansible that referenced this pull request Nov 12, 2018
* clarify port.mode paramter requiremets, fail if unmet

* changelog fragment

* shorten too long line

* remove unnecessary indentation

* test version on docker_version for better maintainability

* normalize imports

* changelog fragment: minor_changes -> bugfixes

* rollback e96a7e57dfefd566fa47cf465a759637affd4795

* typo

Co-Authored-By: dariko <dariko@users.noreply.github.com>
abadger pushed a commit that referenced this pull request Nov 13, 2018
* clarify port.mode paramter requiremets, fail if unmet

* changelog fragment

* shorten too long line

* remove unnecessary indentation

* test version on docker_version for better maintainability

* normalize imports

* changelog fragment: minor_changes -> bugfixes

* rollback e96a7e57dfefd566fa47cf465a759637affd4795

* typo

Co-Authored-By: dariko <dariko@users.noreply.github.com>

(cherry picked from commit 89bcd3f)
mjmayer pushed a commit to mjmayer/ansible that referenced this pull request Nov 30, 2018
* clarify port.mode paramter requiremets, fail if unmet

* changelog fragment

* shorten too long line

* remove unnecessary indentation

* test version on docker_version for better maintainability

* normalize imports

* changelog fragment: minor_changes -> bugfixes

* rollback e96a7e57dfefd566fa47cf465a759637affd4795

* typo

Co-Authored-By: dariko <dariko@users.noreply.github.com>
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
* clarify port.mode paramter requiremets, fail if unmet

* changelog fragment

* shorten too long line

* remove unnecessary indentation

* test version on docker_version for better maintainability

* normalize imports

* changelog fragment: minor_changes -> bugfixes

* rollback e96a7e57dfefd566fa47cf465a759637affd4795

* typo

Co-Authored-By: dariko <dariko@users.noreply.github.com>
@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 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.

docker_swarm_service: Unable to publish a port in host mode
5 participants