Commit graph

47 commits

Author SHA1 Message Date
Hannes Ljungberg
1b90e10cf0 docker_swarm_service: Make secret_id and config_id optional (#58299)
* Lookup secret id by name if not set

* Lookup config id by name if not set

* Add changelog fragment

* Remove usage of secret/config_id in examples

* Python 2.6 compat

* Extend secrets and configs tests
2019-06-27 22:24:34 +02:00
Felix Fontein
66a4000058
Adjust tests to new error messages for older docker-py versions. (#58253) 2019-06-23 21:52:24 +02:00
Dmitriy Yakovlev
122d4164c5 docker_swarm_service: Added default value for mounts.source (#58039)
* Added default value for mounts.source

* Added the changelog fragment

* Added tests

* Fixed separators

* Moved the teardown section at the end
2019-06-20 15:58:32 -04:00
Felix Fontein
7cd229aa97
Fix assignments in docker tests. (#57249) 2019-05-31 23:47:53 +02:00
Hannes Ljungberg
14c60e6ec8 docker_swarm_service: Use str type for configs/secrets gid/uid (#55591)
* Change type of secrets gid/uid to str
* Add changelog fragment

Co-Authored-By: hannseman <hannes@5monkeys.se>
2019-04-22 11:29:46 -04:00
Felix Fontein
12d26eceb1 docker modules: make sure everything works with older docker-py versions (#55258)
* General test improvements.

* Adjust tests to older docker-py versions.

* docker_swarm_server_info: work around problems with older docker-py versions

* Bump minimal docker-py version for options network_filters and disk_usage.

* More general test improvements.

* Correct usage of docker_image.

* Put files into output directory.

* Speed up test.

* Remove old check.
2019-04-17 13:50:57 -04:00
Matt Clay
55d9ee0cb2 Revert "Temporarily skip failing Docker tests on RHEL 7.6."
This reverts commit affde96fa8.
2019-03-27 10:02:49 -07:00
Matt Clay
affde96fa8 Temporarily skip failing Docker tests on RHEL 7.6. 2019-03-26 20:59:38 -07:00
Hannes Ljungberg
be293fbe50 docker_swarm_service: Remove configs and secrets defaults (#54361)
* Remove defaults

* Skip redundant casting

* Indentation fix

* Use generic compare functions

* Add tests for compare functions

* Remove extra whitespace

* Add changelog fragment
2019-03-26 09:45:40 -04:00
Matt Clay
906427caba
Add shippable/posix/group4/ for CI. (#53816) 2019-03-15 07:25:37 -07:00
Hannes Ljungberg
7bb174214c docker_swarm_service: Add option rollback_config (#53594)
* Add rollback_config

* Add change log fragment

* Fix broken test

* Actually fix broken tests

* Add rollback_config example

* Default rollback_config as None

* Abort early if rollback_config does not exist
2019-03-11 18:55:41 +10:00
Hannes Ljungberg
57f706e5a0 docker_swarm_service: Extend mount options (#53559)
* Add mount options

* Remove mount readonly default

* Fix driver_config test

* Add documentation

* Add changelog fragment

* Properly indent tmpfs_ options

* Use correct service suffix for mount tests

* Check for None value on tmpfs usage check

* Document change of mounts.readonly return key

* Use correct change log type

* Really use correct change log type

* Revert changing mount.readonly to read_only
2019-03-09 14:35:57 -06:00
Hannes Ljungberg
f5faf8211d docker_swarm_service: Add read_only option (#53482)
* Add read_only option

* Add changelog fragment

* Add version_added

* Fix broken test
2019-03-08 03:34:49 -05:00
Hannes Ljungberg
3d07e7241a docker_swarm_service: Documentation fixes (#53479)
* Document and validate mode choices

* Update examples

* Test cpu float values

* Test correct option

* Fix module return sample

* Add secrets and user to module return value

* Order options alphabetically

* Add changelog

* yaml indentation

* Revert "Order options alphabetically"

This reverts commit 51dabccda7.

* Be consistent with choices type
2019-03-07 16:51:59 -06:00
Matt Clay
3907ea31f5 Rebalance docker_* integration tests. 2019-03-07 10:59:40 -08:00
Felix Fontein
a904bc7797 improve docker_* test speed (#53417)
* docker_swarm_service tests: use 'resolve_image: no' to avoid registry lookup if image is up-to-date.

* Improve docker_node performance: don't sleep after last try.
2019-03-06 14:01:00 -08:00
Hannes Ljungberg
c563caf451 docker_swarm_service: Set minimum docker-py version to 2.0.2 (#53295)
* Fix version checks in tests

* Set minimum version to 2.0.2

* Networks can only be updated >= docker-py 2.7

* Constraints require docker-py 2.4.0

* Healthchecks require docker-py 2.6.0

* Properly run tests different docker_py_versions

* Add changelog fragment

* Specify lowest version on placement.constraints

* Fix running new tests on older docker-py

* Handle different hosts formats returned by docker

* FIx test naming

* Quote str options

* secrets options require docker-py 2.4.0
2019-03-06 20:50:05 +00:00
Felix Fontein
61abbfc269 docker_swarm_service: rename return variable to swarm_service (#53229)
* Rename return variable to swarm_service.

* Add changelog.

* Add that old name will stay in Ansible 2.7.x.
2019-03-06 10:27:11 +00:00
Hannes Ljungberg
7a130d5446 docker_swarm_service: Add hosts option (#53290)
* Add hosts option

* Add changelog fragment
2019-03-05 18:59:49 +00:00
Felix Fontein
1323dca9e9 docker_*: enable RHEL8 tests (#53313) 2019-03-05 10:50:28 -08:00
Hannes Ljungberg
139abd0849 docker_swarm_service: Add option groups (#53213)
* Add logging option

* Add limits option

* Add reservations option

* Add restart_config option

* Add update_config option

* Add placement option and remove placement_preferences

* Yaml indentation

* Use correct PR number for change log

* Handle grouper fallbacks better

* Add removed_in_version to argument spec

* Fix broken suboption usage check

* Reduce duplicate deprecated option tests

* Clearer deprecation documentation

* Compare bytes with MiB

* Use correct test service suffix
2019-03-05 16:07:27 +00:00
Felix Fontein
a7cee49913 Only run docker swarm based tests on VMs. (#53292) 2019-03-04 16:20:36 -05:00
Felix Fontein
8e26c2dfbe docker_swarm: support older docker-py versions (#53129)
* Decreasing docker_swarm requirements.

* Fixing docker-py / docker API version requirements, and some comments.

* Add changelog.

* Only send parameters specified by user to docker daemon.

* Extend labels test: not specifying == keep labels.

* Bump minimally required docker-py version for docker_node and docker_node_facts to 2.4.0.

* Prevent crashing when publish or healthcheck is not provided.

* Similarly to docker_swarm tests, only execute docker_node tests on real VMs and restart docker daemon when tests are done.
2019-03-04 12:10:09 +01:00
Hannes Ljungberg
dd4b4aa941 docker_swarm_service: Add stop_grace_period option (#52519)
* Add stop_grace_period option

* Add changelog fragment

* Move doc type to last

* Add version_added
2019-02-21 20:12:13 +00:00
Hannes Ljungberg
da8574c567 docker_swarm_service: Allow passing period strings on relevant options (#52530)
* Allow duration to be passed as duration strings

* Remove whitespace

* Add changelog fragment

* Fix broken test

* Better error handling
2019-02-21 11:47:06 +00:00
Hannes Ljungberg
7276344f85 docker_swarm_service: Don’t remove service when networks change (#52634)
* Don’t remove service when networks change

* Add changelog fragment

* Some more network integration tests

* Add hannseman as author

* Remove return on self.client.fail
2019-02-21 11:46:50 +00:00
Hannes Ljungberg
0bf9052e06 docker_swarm_service: Remove defaults (#52420)
* Remove update_parallelism default

* Remove update_delay default

* Add documentation about removing defaults

* Present porting guide changes as a list
2019-02-18 14:19:19 -05:00
Hannes Ljungberg
c80ad43371 docker_swarm_service: Add working_dir option (#52425)
* Add working_dir option

* Check local mounts var to align with other checks

* Add changelog fragment

* Add trailing comma
2019-02-18 13:42:19 +00:00
Hannes Ljungberg
64b12d2c0d docker_swarm_service: Add groups option (#52428)
* Add groups option

* Add changelog fragment

* Remove whitespace

* Remove whitespace
2019-02-18 13:12:05 +00:00
Hannes Ljungberg
18b968d486 docker_swarm_service: Add healthcheck option (#52419)
* Define yaml versions as strings

* Add healthcheck option

* Add changelog fragment

* Don’t set version_added as strings

* Use single quoted string

* Disable healthcheck tests on python 2.6

* Bring back quoting on already quoted version-added

* Python 2.6 compat

* Move functions to docker-common

* Move parse_healthcheck to docker-common

* Cast exception to str before printing failure

* Extend parse_healthcheck tests
2019-02-18 09:46:14 +00:00
Hannes Ljungberg
77d116f66e docker_swarm_service: Add stop_signal option (#52424)
* Add stop_signal option

* Add changelog fragment
2019-02-18 09:43:35 +00:00
Hannes Ljungberg
70d8f02db7 docker_swarm_service: Extend env and add env_files support (#51762)
* Extend env and add env_files support

* Python 2.6 compat

* Handle lists passed as string

* Add changelog fragment

* Use correct link formatting

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Fix typo

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Handle empty env and env_files values
2019-02-12 08:06:58 +00:00
Hannes Ljungberg
153e996760 docker_swarm_service: Remove defaults (#51216)
* Drop descriptions of docker-py constraints <=3.0.0

* Properly indent documentation

* Clearer examples

* Spelling

* Fix example

* Revert "Drop descriptions of docker-py constraints <=3.0.0"

This reverts commit 8106215af62ae5880c3b748cec562a85f2247bdc.

# Conflicts:
#	lib/ansible/modules/cloud/docker/docker_swarm_service.py

* Add min versions for placement preferences

* Add endpoint_mode and publish to option_minimal_versions

* Restrict update max_failure_ratio and monitor versions

* Remove defaults and only pass required arguments

* Fix indentation

* Fix args documentation

* Fix replicas documentation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Add type to all documented options

* Add suboptions for mounts, secrets and configs

* Add suboptions to argument spec

* Remove redundant validation and casting

* Don’t default Spec.EndpointSpec.Mode to vip

* Use single quotes as string literal

* Catch ImportError explicitly

* Move init to top of class

* Align closing brackets

* Spelling

* Import LooseVersion

* Documentation fixes

* Documentation fix

* Documentation fixes

* Remove required: false and default=None

* Defaults for update_delay and update_parallelism

* Set correct key for default

* Handle empty idempotency

* Clearer image documentation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Clearer constraint documentation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Better documentation of corresponding service opts
2019-02-10 14:17:59 +00:00
Hannes Ljungberg
4a5d38b55a docker_swarm_service: Enable tests (#51170)
* Enable tests

* Comment fixes

* Try lowering timeouts

* Comment fix

* Comment fix

* Comment fix

* Add a pause to let service update

* Fix comment

* Disable dns_search tests

* Disable dns_servers test

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Revert "Disable dns_servers test"

This reverts commit 763e9da716b78f4986f313b3ba1ab98faacb742e.

* Revert "Disable dns_search tests"

This reverts commit 2859e4e3a5ebdca078de84d821bb53bbdf967dfd.

* Revert "Add a pause to let service update"

This reverts commit e990dfae1a62e9a42b07960819818bc75fd04427.

* Revert "Try lowering timeouts"

This reverts commit 1617772de81ecef0e560b38c7564646ec3874c3c.

* Ensure that services are running while testing

* Retry tasks on update out of sequence error

* Remove unnecessary check for APIError.explanation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Ignore errors when tearing down test suite

* Retry with a loop instead of tail recursion

* Initialize self.diff_trace in run

* Add change log fragment

* Actually raise error

* Add unit test for retrying

* Lint

* Change to bugfix

* Remove whitespace

* Mock docker dependency

* Use download.fedoraproject.org

* Revert "Use download.fedoraproject.org"

This reverts commit 5931791f7c.
2019-02-05 08:25:29 +00:00
Felix Fontein
89a1c68f98 docker_volume: improve force option (deprecate, add new option) (#51145)
* docker_volume: Deprecating force option, adding recreate option.

* Add changelog.

* Remove mis-placed force: yes for docker_volume.
2019-02-03 15:09:24 -05:00
Hannes Ljungberg
72a44e144a docker_swarm_service: Compare image by digest (#51134)
* Compare image by digest

* Add changelog fragment

* Fix version check

* Remove unused import

* Add note about image resolving

* Don’t overwrite image

* Fix documentation error

* Add resolve_image option

* Add version_added

* Remove whitespace

* Remove unused attribute

* Remove unused attribute
2019-01-27 11:48:16 -05:00
Hannes Ljungberg
ee39853426 docker_swarm_service: Fix endpoint mode idempotency (#51232)
* Fix endpoint mode idempotency

* Remove newline
2019-01-27 09:06:09 -05:00
Felix Fontein
e3f8e05ecb Temporarily disable tests. (#51148) 2019-01-21 17:13:44 -05:00
Hannes Ljungberg
e3f61f4480 docker_swarm_service: Add command option (#50984)
* Add command option

* Fix test task name

* Changelog fragment

* Fix indendation

* Add version_added

* Better command description

* Test passing command as list

* Handle invalid command types

* Cleaner command type checking

* Check that all items in command list are strings

* Better error about command list items

* Better type checking errors

* Add tests for command type checking

* Update command tests

* Fix messed up rebase
2019-01-21 16:01:22 -05:00
Hannes Ljungberg
9c44dc371b docker_swarm_service: Fix crash when using configs parameter (#50606)
* Fix crash when using configs parameter

* Don’t add difference for configs set to None

* Add changelog fragment

* Revert "Add changelog fragment"

This reverts commit 8df497e3881d976e7417d2662a167694fbc33147.

* Enable config tests

* Pass empty list of configs to docker

* Properly clean up after all tests
2019-01-21 15:29:00 -05:00
Hannes Ljungberg
393bf5e4b1 docker_swarm_service: Add placement_preferences option (#51082)
* Add placement_preferences option

* Add changelog fragment

* Python 2.6 compat

Python 2.6 compat

* Cleaner check

* Better description

* Don’t compare placement_preferences if None

* Add placement_preferences example
2019-01-21 14:55:26 -05:00
Hannes Ljungberg
7ceb2ac95a docker_swarm_service: Fix publish idempotency when mode is None (#50882)
* Fix publish idempotency when mode is None

* Add changelog fragment

* Python 2.6 compat

* Use self.publish

* Check length of publish before comparing content

* Sort publish lists before zipping

* Enable publish tests

* python3 compat

* Don’t sort by mode as it is not safe

* Document publish suboptions and add them to args

* Add type to publish documentation

* Add choices to publish argument_spec suboptions

* Make tcp the default protocol

* Make documentation reflect protocol default

* Simplify setting mode

* Remove redundant string quoting

* Test order of publish

* Add comment about publish change detection
2019-01-21 14:02:08 -05:00
Hannes Ljungberg
d264bf4f4e docker_swarm_service: Add option tests (#50699)
* Add option tests

* Check for api version on publish

* Enable configs tests

* Remove unsupported test

* Let main.yml hande creation/destruction of swarms

* Revert "Remove unsupported test"

This reverts commit 50f46bb04e.

* Revert "Enable configs tests"

This reverts commit a94054b0bb.

* Fix typo to properly clear secrets
2019-01-16 03:50:06 -05:00
Felix Fontein
495a426039 docker_swarm: fix minimal API version (#49691)
* Reduce minimally required docker API version to 1.25, with selective features requiring 1.30.

* Adjust test requirements.

* Forgot some imports.
2018-12-10 14:09:28 +05:30
Felix Fontein
3bb41ccb8e docker_* tests: check API version (#48620)
* Check minimal API and docker-py versions for all docker_* tests.

* Improve docker_swarm creation/destruction for tests.

* Fail when conditions aren't met.

* Don't hardcode address for advertise_addr.
2018-11-19 10:01:40 +00:00
Matt Clay
a41c0405a7
Add CI platform: rhel/8.0 (#48835) 2018-11-16 22:06:19 -08:00
Dario Zanzico
2162d7d4de Docker swarm service integration tests (#45674)
* integration test for docker_swarm_service

* ensure stack de-initialization

* Set default value for 'configs' parameter to None

Docker-py uses None as a default value for configs.
Using the same default here allows to create services on older docker
setups (docker_api<1.30).

* Set default value for 'update_order' parameter to None

Docker-py uses None as a default value for update_order.
Using the same default here allows to create services on older docker
setups (docker_api<1.29)

* Set default value for 'publish.mode' parameter to None

Docker-py uses None as a default value for publish_mode.
Using the same default here allows to create services on older docker
setups (docker_api<1.32)

* Allow tests to run on older version of docker.

* remove workarounds for old docker versions

* test correct swarm cleanup

* changelog fragment for docker_swarm_service defaults change
2018-10-29 11:28:51 +00:00