Commit Graph

293 Commits

Author SHA1 Message Date
Felix Fontein
dbc7b0ec18
Cleanup with ruff check (#1182)
* Implement improvements suggested by ruff check.

* Add ruff check to CI.
2025-10-28 06:58:15 +01:00
Felix Fontein
be000755fc
Python code modernization, 8/n (#1179)
* Use to_text instead of to_native.

* Remove no longer needed pylint ignores.

* Remove another pylint ignore.

* Remove no longer needed ignore.

* Address redefined-outer-name.

* Address consider-using-with.
2025-10-25 00:36:04 +00:00
Felix Fontein
6ad4bfcd40
Add typing information, 2/n (#1178)
* Add typing to Docker Stack modules. Clean modules up.

* Add typing to Docker Swarm modules.

* Add typing to unit tests.

* Add more typing.

* Add ignore.txt entries.
2025-10-25 01:16:04 +02:00
Felix Fontein
3350283bcc
Add typing information, 1/2 (#1176)
* Re-enable typing and improve config.

* Make mypy pass.

* Improve settings.

* First batch of types.

* Add more type hints.

* Fixes.

* Format.

* Fix split_port() without returning to previous type chaos.

* Continue with type hints (and ignores).
2025-10-23 07:05:42 +02:00
Felix Fontein
6b5d76bdee
Adjust 'report this' messages to only report if the latest version still has this problem. (#1173) 2025-10-16 17:41:11 +02:00
Felix Fontein
3ff2cfe615
Drop support for docker-py. (#1171) 2025-10-15 21:55:07 +02:00
Felix Fontein
17e30adb93
selectors is now part of stdlib. (#1166) 2025-10-12 22:00:51 +02:00
Felix Fontein
c75aa5dd64
Python code modernization, 5/n (#1165)
* Address raise-missing-from.

* Address simplifiable-if-expression.

* Address unnecessary-dunder-call.

* Address unnecessary-pass.

* Address use-list-literal.

* Address unused-variable.

* Address use-dict-literal.
2025-10-12 16:02:27 +02:00
Felix Fontein
cad22de628
Python code modernization, 4/n (#1162)
* Address attribute-defined-outside-init.

* Address broad-exception-raised.

* Address broad-exception-caught.

* Address consider-iterating-dictionary.

* Address consider-using-dict-comprehension.

* Address consider-using-f-string.

* Address consider-using-in.

* Address consider-using-max-builtin.

* Address some consider-using-with.

* Address invalid-name.

* Address keyword-arg-before-vararg.

* Address line-too-long.

* Address no-else-continue.

* Address no-else-raise.

* Address no-else-return.

* Remove broken dead code.

* Make consider-using-f-string changes compatible with older Python versions.

* Python 3.11 and earlier apparently do not like multi-line f-strings.
2025-10-11 23:06:50 +02:00
Felix Fontein
33c8a49191
Fix crashes due to wrong names. (#1161) 2025-10-11 15:29:14 +02:00
Felix Fontein
892e9d9cbd Reorganize imports due to https://github.com/ansible-community/antsibull-nox/pull/136. 2025-10-10 21:19:28 +02:00
Felix Fontein
e8ec22d3b1
Python code modernization, 3/n (#1157)
* Remove __metaclass__ = type.

for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do
  sed -e '/^__metaclass__ = type/d' -i $i;
done

* Remove super arguments, and stop inheriting from object.
2025-10-10 08:11:58 +02:00
Felix Fontein
741c318b1d
Python code modernization, 2/n (#1156)
* Adjust all __future__ imports:

for i in $(grep -REl "__future__.*absolute_import" plugins/ tests/); do
  sed -e 's/from __future__ import .*/from __future__ import annotations/g' -i $i;
done

* Remove all UTF-8 encoding specifications for Python source files:

for i in $(grep -REl '[-][*]- coding: utf-8 -[*]-' plugins/ tests/); do
  sed -e '/^# -\*- coding: utf-8 -\*-/d' -i $i;
done

* Reformat.
2025-10-09 20:46:48 +02:00
Felix Fontein
a3efa26e2e
Address some pylint issues (#1155)
* Address cyclic-import.

* Address redefined-builtin.

* Address redefined-argument-from-local.

* Address many redefined-outer-name.

* Address pointless-string-statement.

* No longer needed due to separate bugfix.

* Address useless-return.

* Address possibly-used-before-assignment.

* Add TODOs.

* Address super-init-not-called.

* Address function-redefined.

* Address unspecified-encoding.

* Clean up more imports.
2025-10-09 20:11:36 +02:00
Felix Fontein
acf18f0ade
Add more CI checks (#1150)
* Enable mypy.

* Add flake8.

* Add pylint with a long list of ignores to be removed.
2025-10-07 19:37:16 +02:00
Felix Fontein
54c2e49fdf
Fix diff for plugin options. (#1146) 2025-10-07 18:31:27 +02:00
salty
ebb8569b5f
docker_container: add driver_opts and gw_priority (#1143)
closes #1142
2025-10-07 18:26:25 +02:00
Felix Fontein
117271579e
Make all doc fragments, module utils, and plugin utils private (#1144)
* Make all doc fragments, module utils, and plugin utils private.

* Remove some unused and no longer needed imports.

This hopefully also fixes the CI issues, which do not happen locally for me...

* Fix formatting.

* Try to make CI happy, again.

* Fix imports.

* Lint.
2025-10-07 07:32:33 +02:00
Felix Fontein
d65d37e9e9 Reformat code with black and isort. 2025-10-06 18:34:59 +02:00
Felix Fontein
f45232635c
Python code modernization, 1/n (#1141)
* Remove unicode text prefixes.

* Replace str.format() uses with f-strings.

* Replace % with f-strings, and do some cleanup.

* Fix wrong variable.

* Avoid unnecessary string conversion.
2025-10-06 18:30:54 +02:00
Felix Fontein
1f2817fa20
Prepare 5.0.0 (#1123)
* Bump version to 5.0.0-a1.

* Drop support for ansible-core 2.15 and 2.16.

* Remove Python 2 and early Python 3 compatibility.
2025-10-05 20:22:50 +02:00
Felix Fontein
ebe42308cc
Replace ansible.module_utils.six with own module utils in some cases (#1138)
* Replace ansible.module_utils.six with own module utils in some cases.

* Add ignore.txt entires.
2025-10-04 23:45:27 +02:00
Felix Fontein
fd011d3871
Support missing fields and missing types in mounts. (#1134) 2025-09-29 22:35:07 +02:00
Laurent Commarieu
ba58752646
Rename login_results to login_result in docker_login docstring (#1121) 2025-08-26 21:48:57 +02:00
Felix Fontein
68ac6fecb1
Avoid deprecated functionality. (#1117) 2025-08-17 20:15:40 +02:00
Felix Fontein
e1920d1cc7
Work around bug in Docker 28.3.3 that prevents pushing to registry without authentication. (#1110) 2025-08-03 15:19:16 +02:00
tpourcelot
449448e820
docker_swarm_service: add support for replicated jobs (#1108)
* feat(docker_swarm_service): Add support for replicated jobs

* chore(docker_swarm_plugin): Fixes after review

* chore(docker_swarm_service): Add a check for minimum version

* chore(docker_swarm_service): Add changelog fragment for #1108

* fix(docker_swarm_service): Fix typo in version check

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Tristan Pourcelot <tristan.pourcelot@exatrack.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2025-08-03 13:12:29 +02:00
Felix Fontein
ad989c1942
docker_container_copy_into: add mode_parse option (#1074)
* Add mode_parse option.

* Make yamllint config strict.

* Lint.
2025-04-28 20:46:11 +02:00
Felix Fontein
2487d1a0bf Fix linting errors. 2025-04-26 12:39:00 +02:00
Felix Fontein
3a3ece3ba5
Warn about octal modes. (#1072) 2025-04-26 12:22:16 +02:00
Felix Fontein
635716c07b
docker_compose_v2: use --yes when available instead of -y (#1060)
* Use --yes if available.

* Add smoke test.
2025-03-21 22:05:10 +01:00
londondaintta
c13b891bc9
fix(docker_compose_v2): fix version check (#1059)
* fix version check

* add changelog fragment
2025-03-17 20:20:21 +01:00
Jonas Geiler
a3f9c21228
fix(docker_compose_v2): use correct flag for assume_yes (#1054)
* fix: use correct flag for `assume_yes`

The correct flag is `--y`, not `--yes`.

* refactor(docker_compose_v2): use `-y` instead of `--y` to ensure future compatibility

Maybe they'll change it back to `--yes` sometime, so I'll use the short form that most likely won't change.

* docs(docker_compose_v2): add note about `-y` flag

Co-authored-by: Felix Fontein <felix@fontein.de>

* chore: add changelog fragment

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2025-03-10 22:18:45 +01:00
Felix Fontein
cfb970bd53
docker_network: add enable_ipv4 option (#1049)
* Add enable_ipv4 option.

* Add changelog fragment.
2025-03-01 15:03:43 +01:00
londondaintta
187014101b
add --yes parameter to docker compose up (#1045)
* add yes option for compose up to assume yes and prevent hanging

* fix type

* add default

* add changelog fragment

* Apply doc suggestion

Co-authored-by: Felix Fontein <felix@fontein.de>

* set version_added to 4.5.0

* use `assume_yes` to avoid clashing with yaml `yes` keyword

* add version check

* default self.yes to False

* update description

* Fail on older version

Co-authored-by: Felix Fontein <felix@fontein.de>

* update changelog fragment

* update description

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2025-03-01 15:03:23 +01:00
Felix Fontein
5ce4783053 Prepare 4.4.0 release. 2025-02-13 21:10:00 +01:00
Felix Fontein
22ab85fe2b
docker_context_info: fix some aspects (#1043)
* Extend docker_context_info tests.

* Fix a bug in the context code.

* Fix TLS handling for contexts.

* Adjust code to fix tests.
2025-02-10 23:54:36 +01:00
Felix Fontein
3b6068e44b
Add docker_context_info module (#1039)
* Vendor parts of the Docker SDK for Python

This is a combination of the latest git version
(db7f8b8bb6)
with some fixes to make it compatible with Python 2.7
and adjusting some imports.

* Polishing.

* Fix bug that prevents contexts to be found when no Docker config file is present.

Ref: https://github.com/docker/docker-py/issues/3190

* Linting.

* Fix typos.

* Adjust more to behavior of Docker CLI.

* Add first iteration of docker_context_info module.

* Improvements.

* Add basic CI.

* Add caveat on contexts[].config result.
2025-02-10 21:59:05 +01:00
Alexandre Díaz
ea3ac5f195
fix: docker_compose_v2_run: don't need sanitize labels (#1034) 2025-02-02 17:27:28 +01:00
Felix Fontein
8bae4e9c6d
Also mention glob patterns and redirects. (#1032) 2025-01-25 22:26:17 +01:00
Felix Fontein
5bfec5d4d2
Add 'idempotent' attribute (#1022)
* Add 'idempotent' attribute.

* Mention check mode in attribute description.

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2024-12-30 21:11:14 +01:00
Felix Fontein
bd992583c2 Improve formulations. 2024-12-28 17:09:33 +01:00
Felix Fontein
769d15de63
Reformat documentation with 'andebox yaml-doc' (#1020)
* Reformat documentation with 'andebox yaml-doc'.

* Revert unwanted changes.

* Fix too long lines.

* Fix broken quotes.

* Forgot two line breaks.
2024-12-28 16:40:50 +01:00
Felix Fontein
f69536ef3b Improve language. 2024-12-28 14:30:49 +01:00
Felix Fontein
d17ee667ce
docker_network: adjust documentation to reality for state=absent + force=true. (#1016) 2024-12-20 22:51:04 +01:00
Felix Fontein
8616e7f6f2
docker_image_build: work around strange behavior of docker buildx build when --output is provided (#1006)
* Work around strange behavior of docker buildx build when --output is provided.

* Adjust tests.

* Allow to pass multiple image names; correctly quote --output values.

* Return executed command.

* Adjust tests.
2024-12-14 21:32:33 +01:00
Felix Fontein
2e7b4e4605
docker_compose_v2: add ignore_build_events option; ignore build events by default (#1011)
* Add ignore_build_events option.

* Adjust docs and tests.

* Switch default to true.

* Remove unnecessary parts from tests.
2024-12-14 19:54:40 +01:00
Felix Fontein
7583ea82ac
Prevent crash if Mode isn't present, which happens for Swarm jobs. (#1003) 2024-12-04 21:39:50 +01:00
Maksim Vorobyev
e19812917d
Add 'ingress' option to docker_network module (#999)
* Add 'ingress' option to docker_network module

* sanity fixes

* add changelog fragment

* Update plugins/modules/docker_network.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/999-add-ingress-option-to-docker_network-module.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_network.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* move 'ingress' tests to overlay.yml

* move Sworm init and Swarm cleanup to block

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-12-04 21:39:09 +01:00
Michael
6595d299e2
Doc fix for docker_container image_name_mismatch (#991)
* doc-fix-image-name-mismatch

* Update description.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-11-23 14:12:27 +01:00