Prepare 4.0.0 release. (#971)

This commit is contained in:
Felix Fontein
2024-10-18 21:01:49 +02:00
committed by GitHub
parent 8c5b90df55
commit f7823ea626
63 changed files with 42 additions and 2468 deletions
-1
View File
@@ -21,7 +21,6 @@ notes:
with Python's C(SSLSocket)s. See U(https://github.com/ansible-collections/community.docker/issues/605) for more information.
extends_documentation_fragment:
- community.docker.docker.api_documentation
- community.docker.docker.ssl_version_deprecation
- community.docker.docker.var_names
options:
remote_user:
+2 -29
View File
@@ -71,14 +71,6 @@ options:
the file C(key.pem) from the directory specified in the environment variable E(DOCKER_CERT_PATH) will be used.
type: path
aliases: [ tls_client_key, key_path ]
ssl_version:
description:
- Provide a valid SSL version number. Default value determined by L(SSL Python module, https://docs.python.org/3/library/ssl.html).
- If the value is not specified in the task, the value of environment variable E(DOCKER_SSL_VERSION) will be
used instead.
- B(Note:) this option is no longer supported for Docker SDK for Python 7.0.0+. Specifying it with Docker SDK for
Python 7.0.0 or newer will lead to an error.
type: str
tls:
description:
- Secure the connection to the API by using TLS without verifying the authenticity of the Docker host
@@ -110,7 +102,7 @@ options:
notes:
- Connect to the Docker daemon by providing parameters with each task or by defining environment variables.
You can define E(DOCKER_HOST), E(DOCKER_TLS_HOSTNAME), E(DOCKER_API_VERSION), E(DOCKER_CERT_PATH), E(DOCKER_SSL_VERSION),
You can define E(DOCKER_HOST), E(DOCKER_TLS_HOSTNAME), E(DOCKER_API_VERSION), E(DOCKER_CERT_PATH),
E(DOCKER_TLS), E(DOCKER_TLS_VERIFY) and E(DOCKER_TIMEOUT). If you are using docker machine, run the script shipped
with the product that sets up the environment. It will set these variables for you. See
U(https://docs.docker.com/machine/reference/env/) for more details.
@@ -148,9 +140,6 @@ options:
client_key:
vars:
- name: ansible_docker_client_key
ssl_version:
vars:
- name: ansible_docker_ssl_version
tls:
vars:
- name: ansible_docker_tls
@@ -250,12 +239,6 @@ options:
the file C(key.pem) from the directory specified in the environment variable E(DOCKER_CERT_PATH) will be used.
type: path
aliases: [ tls_client_key, key_path ]
ssl_version:
description:
- Provide a valid SSL version number. Default value determined by L(SSL Python module, https://docs.python.org/3/library/ssl.html).
- If the value is not specified in the task, the value of environment variable E(DOCKER_SSL_VERSION) will be
used instead.
type: str
tls:
description:
- Secure the connection to the API by using TLS without verifying the authenticity of the Docker host
@@ -286,7 +269,7 @@ options:
notes:
- Connect to the Docker daemon by providing parameters with each task or by defining environment variables.
You can define E(DOCKER_HOST), E(DOCKER_TLS_HOSTNAME), E(DOCKER_API_VERSION), E(DOCKER_CERT_PATH), E(DOCKER_SSL_VERSION),
You can define E(DOCKER_HOST), E(DOCKER_TLS_HOSTNAME), E(DOCKER_API_VERSION), E(DOCKER_CERT_PATH),
E(DOCKER_TLS), E(DOCKER_TLS_VERIFY) and E(DOCKER_TIMEOUT). If you are using docker machine, run the script shipped
with the product that sets up the environment. It will set these variables for you. See
U(https://docs.docker.com/machine/reference/env/) for more details.
@@ -394,13 +377,3 @@ notes:
- This module does B(not) use the L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) to
communicate with the Docker daemon. It directly calls the Docker CLI program.
'''
# DEPRECATED: this will be removed from community.docker 4.0.0! Use with care!
SSL_VERSION_DEPRECATION = '''
options:
ssl_version:
deprecated:
why: This was necessary a long time ago to handle problems with older TLS/SSL versions. It is no longer necessary nowadays.
version: 4.0.0
alternatives: None.
'''
-1
View File
@@ -21,7 +21,6 @@ author:
extends_documentation_fragment:
- ansible.builtin.constructed
- community.docker.docker.api_documentation
- community.docker.docker.ssl_version_deprecation
- community.library_inventory_filtering_v1.inventory_filter
description:
- Reads inventories from the Docker API.
-10
View File
@@ -77,15 +77,6 @@ DOCUMENTATION = r'''
description: When verifying the authenticity of the Docker host server, provide the expected name of
the server.
type: str
ssl_version:
description:
- Provide a valid SSL version number. Default value determined
by L(SSL Python module, https://docs.python.org/3/library/ssl.html).
type: str
deprecated:
why: This was necessary a long time ago to handle problems with SSL versions. It is no longer necessary nowadays.
version: 4.0.0
alternatives: None.
api_version:
description:
- The version of the Docker API running on the Docker Host.
@@ -197,7 +188,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
tls_hostname=self.get_option('tls_hostname'),
api_version=self.get_option('api_version'),
timeout=self.get_option('timeout'),
ssl_version=self.get_option('ssl_version'),
use_ssh_client=self.get_option('use_ssh_client'),
debug=None,
)
-15
View File
@@ -122,18 +122,6 @@ if not HAS_DOCKER_PY:
def _get_tls_config(fail_function, **kwargs):
if 'ssl_version' in kwargs and LooseVersion(docker_version) >= LooseVersion('7.0.0b1'):
ssl_version = kwargs.pop('ssl_version')
if ssl_version is not None:
fail_function(
"ssl_version is not compatible with Docker SDK for Python 7.0.0+. You are using"
" Docker SDK for Python {docker_py_version}. The ssl_version option (value: {ssl_version})"
" has either been set directly or with the environment variable DOCKER_SSL_VERSION."
" Make sure it is not set, or switch to an older version of Docker SDK for Python.".format(
docker_py_version=docker_version,
ssl_version=ssl_version,
)
)
if 'assert_hostname' in kwargs and LooseVersion(docker_version) >= LooseVersion('7.0.0b1'):
assert_hostname = kwargs.pop('assert_hostname')
if assert_hostname is not None:
@@ -174,7 +162,6 @@ def get_connect_params(auth, fail_function):
tls_config = dict(
verify=True,
assert_hostname=auth['tls_hostname'],
ssl_version=auth['ssl_version'],
fail_function=fail_function,
)
if auth['cert_path'] and auth['key_path']:
@@ -186,7 +173,6 @@ def get_connect_params(auth, fail_function):
# TLS without verification
tls_config = dict(
verify=False,
ssl_version=auth['ssl_version'],
fail_function=fail_function,
)
if auth['cert_path'] and auth['key_path']:
@@ -334,7 +320,6 @@ class AnsibleDockerClientBase(Client):
cacert_path=self._get_value('cacert_path', params['ca_path'], 'DOCKER_CERT_PATH', None, type='str'),
cert_path=self._get_value('cert_path', params['client_cert'], 'DOCKER_CERT_PATH', None, type='str'),
key_path=self._get_value('key_path', params['client_key'], 'DOCKER_CERT_PATH', None, type='str'),
ssl_version=self._get_value('ssl_version', params['ssl_version'], 'DOCKER_SSL_VERSION', None, type='str'),
tls=self._get_value('tls', params['tls'], 'DOCKER_TLS', DEFAULT_TLS, type='bool'),
tls_verify=self._get_value('tls_verfy', params['validate_certs'], 'DOCKER_TLS_VERIFY',
DEFAULT_TLS_VERIFY, type='bool'),
-3
View File
@@ -83,7 +83,6 @@ def get_connect_params(auth_data, fail_function):
tls_config = dict(
verify=True,
assert_hostname=auth_data['tls_hostname'],
ssl_version=auth_data['ssl_version'],
fail_function=fail_function,
)
if auth_data['cert_path'] and auth_data['key_path']:
@@ -95,7 +94,6 @@ def get_connect_params(auth_data, fail_function):
# TLS without verification
tls_config = dict(
verify=False,
ssl_version=auth_data['ssl_version'],
fail_function=fail_function,
)
if auth_data['cert_path'] and auth_data['key_path']:
@@ -205,7 +203,6 @@ class AnsibleDockerClientBase(Client):
cacert_path=self._get_value('cacert_path', params['ca_path'], 'DOCKER_CERT_PATH', None, type='str'),
cert_path=self._get_value('cert_path', params['client_cert'], 'DOCKER_CERT_PATH', None, type='str'),
key_path=self._get_value('key_path', params['client_key'], 'DOCKER_CERT_PATH', None, type='str'),
ssl_version=self._get_value('ssl_version', params['ssl_version'], 'DOCKER_SSL_VERSION', None, type='str'),
tls=self._get_value('tls', params['tls'], 'DOCKER_TLS', DEFAULT_TLS, type='bool'),
tls_verify=self._get_value('tls_verfy', params['validate_certs'], 'DOCKER_TLS_VERIFY',
DEFAULT_TLS_VERIFY, type='bool'),
@@ -135,11 +135,6 @@ class ContainerManager(DockerBaseClass):
comp_aliases[option_name] = option_name
for alias in option.ansible_aliases:
comp_aliases[alias] = option_name
# Process legacy ignore options
if self.module.params['ignore_image']:
self.all_options['image'].comparison = 'ignore'
if self.module.params['purge_networks']:
self.all_options['networks'].comparison = 'strict'
# Process comparisons specified by user
if self.module.params.get('comparisons'):
# If '*' appears in comparisons, process it first
@@ -184,11 +179,6 @@ class ContainerManager(DockerBaseClass):
for option in self.all_options.values():
if option.copy_comparison_from is not None:
option.comparison = self.all_options[option.copy_comparison_from].comparison
# Check legacy values
if self.module.params['ignore_image'] and self.all_options['image'].comparison != 'ignore':
self.module.warn('The ignore_image option has been overridden by the comparisons option!')
if self.module.params['purge_networks'] and self.all_options['networks'].comparison != 'strict':
self.module.warn('The purge_networks option has been overridden by the comparisons option!')
def _update_params(self):
if self.param_networks_cli_compatible is True and self.module.params['networks'] and self.module.params['network_mode'] is None:
@@ -332,20 +322,9 @@ class ContainerManager(DockerBaseClass):
image_different = False
if self.all_options['image'].comparison == 'strict':
image_different = self._image_is_different(image, container)
if self.param_image_name_mismatch != 'ignore' and self.param_image is not None and self.param_image != container.image_name:
if self.param_image_name_mismatch == 'recreate':
different = True
self.diff_tracker.add('image_name', parameter=self.param_image, active=container.image_name)
else:
# The default has been deprecated!
self.module.deprecate(
'The default value "ignore" for image_name_mismatch has been deprecated and will change to "recreate"'
' in community.docker 4.0.0. In the current situation, this would cause the container to be recreated'
' since the current container\'s image name "{active}" does not match the desired image name "{parameter}".'.format(
parameter=self.param_image, active=container.image_name),
version='4.0.0',
collection_name='community.docker',
)
if self.param_image_name_mismatch == 'recreate' and self.param_image is not None and self.param_image != container.image_name:
different = True
self.diff_tracker.add('image_name', parameter=self.param_image, active=container.image_name)
if image_different or different or self.param_recreate:
self.diff_tracker.merge(differences)
self.diff['differences'] = differences.get_legacy_docker_container_diffs()
@@ -704,13 +683,6 @@ class ContainerManager(DockerBaseClass):
updated_container = self._add_networks(container, network_differences)
purge_networks = self.all_options['networks'].comparison == 'strict' and self.module.params['networks'] is not None
if not purge_networks and self.module.params['purge_networks']:
purge_networks = True
self.module.deprecate(
'The purge_networks option is used while networks is not specified. In this case purge_networks=true cannot'
' be replaced by `networks: strict` in comparisons, which is necessary once purge_networks is removed.'
' Please modify the docker_container invocation by adding `networks: []`',
version='4.0.0', collection_name='community.docker')
if purge_networks:
has_extra_networks, extra_networks = self.has_extra_networks(container)
if has_extra_networks:
@@ -890,11 +862,10 @@ def run_module(engine_driver):
command_handling=dict(type='str', choices=['compatibility', 'correct'], default='correct'),
default_host_ip=dict(type='str'),
force_kill=dict(type='bool', default=False, aliases=['forcekill']),
ignore_image=dict(type='bool', default=False, removed_in_version='4.0.0', removed_from_collection='community.docker'),
image=dict(type='str'),
image_comparison=dict(type='str', choices=['desired-image', 'current-image'], default='desired-image'),
image_label_mismatch=dict(type='str', choices=['ignore', 'fail'], default='ignore'),
image_name_mismatch=dict(type='str', choices=['ignore', 'recreate']),
image_name_mismatch=dict(type='str', choices=['ignore', 'recreate'], default='recreate'),
keep_volumes=dict(type='bool', default=True),
kill_signal=dict(type='str'),
name=dict(type='str', required=True),
@@ -903,7 +874,6 @@ def run_module(engine_driver):
paused=dict(type='bool'),
pull=dict(type='raw', choices=['never', 'missing', 'always', True, False], default='missing'),
pull_check_mode_behavior=dict(type='str', choices=['image_not_present', 'always'], default='image_not_present'),
purge_networks=dict(type='bool', default=False, removed_in_version='4.0.0', removed_from_collection='community.docker'),
recreate=dict(type='bool', default=False),
removal_wait_timeout=dict(type='float'),
restart=dict(type='bool', default=False),
-6
View File
@@ -29,12 +29,6 @@ DOCKER_COMMON_ARGS = dict(
ca_path=dict(type='path', aliases=['ca_cert', 'tls_ca_cert', 'cacert_path']),
client_cert=dict(type='path', aliases=['tls_client_cert', 'cert_path']),
client_key=dict(type='path', aliases=['tls_client_key', 'key_path']),
ssl_version=dict(
type='str',
fallback=(env_fallback, ['DOCKER_SSL_VERSION']),
removed_in_version='4.0.0',
removed_from_collection='community.docker',
),
tls=dict(type='bool', default=DEFAULT_TLS, fallback=(env_fallback, ['DOCKER_TLS'])),
use_ssh_client=dict(type='bool', default=False),
validate_certs=dict(type='bool', default=DEFAULT_TLS_VERIFY, fallback=(env_fallback, ['DOCKER_TLS_VERIFY']), aliases=['tls_verify']),
+1 -12
View File
@@ -10,15 +10,4 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
# Once we drop support for ansible-core 2.11, we can remove the try/except.
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import LooseVersion, StrictVersion # noqa: F401, pylint: disable=unused-import
except ImportError:
try:
from distutils.version import LooseVersion, StrictVersion # noqa: F401, pylint: disable=unused-import
except ImportError as exc:
msg = 'To use this plugin or module with ansible-core 2.11, you need to use Python < 3.12 with distutils.version present'
raise_from(ImportError(msg), exc)
from ansible.module_utils.compat.version import LooseVersion, StrictVersion # noqa: F401, pylint: disable=unused-import
File diff suppressed because it is too large Load Diff
-1
View File
@@ -143,7 +143,6 @@ author:
- Felix Fontein (@felixfontein)
seealso:
- module: community.docker.docker_compose
- module: community.docker.docker_compose_v2_pull
'''
+2 -23
View File
@@ -429,18 +429,6 @@ options:
description:
- The container's hostname.
type: str
ignore_image:
description:
- When O(state) is V(present) or V(started), the module compares the configuration of an existing
container to requested configuration. The evaluation includes the image version. If the image
version in the registry does not match the container, the container will be recreated. You can
stop this behavior by setting O(ignore_image) to V(true).
- "B(Warning:) This option is ignored if C(image: ignore) or C(*: ignore) is specified in the
O(comparisons) option."
- "This option is deprecated since community.docker 3.2.0 and will be removed in community.docker 4.0.0.
Use C(image: ignore) in O(comparisons) instead of O(ignore_image=true)."
type: bool
default: false
image:
description:
- Repository path and tag used to create the container. If an image is not found or pull is true, the image
@@ -485,12 +473,12 @@ options:
- If set to V(recreate) the container will be recreated.
- If set to V(ignore) (currently the default) the container will not be recreated because of this. It might still get recreated for other reasons.
This has been the default behavior of the module for a long time, but might not be what users expect.
- Since community.docker 3.5.0, the default V(ignore) has been deprecated. If not specified, a deprecation warning
will be emitted if this setting would make a difference. The default will change to V(recreate) in community.docker 4.0.0.
- The default changed from V(ignore) to V(recreate) in community.docker 4.0.0.
type: str
choices:
- recreate
- ignore
default: recreate
version_added: 3.2.0
init:
description:
@@ -849,15 +837,6 @@ options:
- image_not_present
- always
version_added: 3.8.0
purge_networks:
description:
- Remove the container from ALL networks not included in O(networks) parameter.
- Any default networks such as C(bridge), if not found in O(networks), will be removed as well.
- "This option is deprecated since community.docker 3.2.0 and will be removed in community.docker 4.0.0.
Use C(networks: strict) in O(comparisons) instead of O(purge_networks=true) and make sure that
O(networks) is specified. If you want to remove all networks, specify O(networks) as C([])."
type: bool
default: false
read_only:
description:
- Mount the container's root file system as read-only.