-
Notifications
You must be signed in to change notification settings - Fork 23.9k
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: Remove defaults #51216
docker_swarm_service: Remove defaults #51216
Conversation
The test
|
@felixfontein @dariko Looks like we may even have to increase the docker api minimum version to 1.32. https://github.com/docker/docker-py/blob/master/docker/api/service.py#L40 It shouldn't be possible for anyone to have used this module successfully with docker-py less than 3.0.0 or docker api less than 1.32. Please correct me if I'm wrong. |
The CI failures are caused by the unstable setup_docker on fedora: https://app.shippable.com/github/ansible/ansible/runs/103417/51/tests |
I guess a better solution would be to make sure that the module also works with older docker-py and docker API versions. The best way to achieve this is probably to change
instead of a tuple, and the calling functions |
That’s true and should be an easy fix. Would have been nice to jump up a major version on docker-py but I guess there’s a lot of people stuck on older ones. We’ll have to limit This fix would depend on #51232 since that removes the default |
Found two more options with defaults that would need to be dropped to maintain the requirement of docker-py 2.0.0.
Added in 2.1.0 https://github.com/docker/docker-py/blob/master/docs/change-log.md#210 and API version 1.25. https://github.com/docker/docker-py/blob/master/docker/api/service.py#L16 |
container_spec_args = {
'image': self.image,
'command': self.command,
'args': self.args,
'env': self.env,
'user': self.user,
'labels': self.container_labels,
'mounts': self.mounts
}
if self.tty is not None:
container_spec_args['tty'] = self.tty
if secrets is not None:
container_spec_args['secrets'] = secrets
if dns_config is not None:
container_spec_args['dns_config'] = dns_config
if configs is not None:
container_spec_args['configs'] = configs
if hostname is not None:
container_spec_args['hostname'] = hostname
cspec = types.ContainerSpec(**container_spec_args) |
@felixfontein this PR turned out to be a bit bigger than expected. There was a lot of arguments that was not compatible with docker-py 2.0.0 but had defaults. After a while there wasn't much left so I felt a bit bold and removed all defaults as they all mapped to existing docker defaults. All non-required docker arguments are now not passed to docker if not explicitly specified. The I'm aware that removing defaults is not something that is made easy but in my opinion it's better to try and fix this now than later. |
The test
The test
The test
|
f6695c9
to
24c8781
Compare
test |
bot_status |
Componentslib/ansible/modules/cloud/docker/docker_swarm_service.py test/integration/targets/docker_swarm_service/tasks/tests/options.yml test/integration/targets/docker_swarm_service/vars/main.yml Metadatawaiting_on: maintainer |
rebuild_merge |
1 similar comment
rebuild_merge |
rebuild_merge |
ok, I'm giving up.... ansibot doesn't seem to like me today... |
I think the problem lies here: |
rebuild_merge |
(CI run triggered manually via bugging people on IRC) |
rebuild_merge (yet another try...) |
@hannseman thanks for the PR! Great work again (as usual ;) )! |
SUMMARY
This PR removes all argument defaults. It will only send required parameters to docker. This fixes an issue where the current module arguments have defaults that are not compatible with the specified docker-py minimum version. Today the minimum docker-py version is 3.0.0 when the stated one is 2.0.0.
This PR also includes a couple of documentation related fixes:
ISSUE TYPE
COMPONENT NAME
docker_swarm_service