docker_image: really deprecate state==build (#52412)

* Really deprecate state==build.

* Also explicitly deprecate use_tls.

* Add changelog.
This commit is contained in:
Felix Fontein 2019-02-18 14:25:25 +01:00 committed by John R Barker
parent 64b12d2c0d
commit 8222ebd23a
2 changed files with 20 additions and 6 deletions

View file

@ -0,0 +1,3 @@
minor_changes:
- "docker_image - the deprecated settings ``state: build`` and ``use_tls`` now
display warnings when being used. They will be removed in Ansible 2.11."

View file

@ -121,7 +121,7 @@ options:
from Docker Hub. To build the image, provide a path value set to a directory containing a context and from Docker Hub. To build the image, provide a path value set to a directory containing a context and
Dockerfile. To load an image, specify load_path to provide a path to an archive file. To tag an image to a Dockerfile. To load an image, specify load_path to provide a path to an archive file. To tag an image to a
repository, provide a repository path. If the name contains a repository path, it will be pushed. repository, provide a repository path. If the name contains a repository path, it will be pushed.
- "NOTE: C(build) is DEPRECATED and will be removed in release 2.3. Specifying C(build) will behave the - "NOTE: C(build) is DEPRECATED and will be removed in release 2.11. Specifying C(build) will behave the
same as C(present)." same as C(present)."
required: false required: false
default: present default: present
@ -163,14 +163,16 @@ options:
- CPUs in which to allow execution, e.g., "0-3", "0,1". - CPUs in which to allow execution, e.g., "0-3", "0,1".
use_tls: use_tls:
description: description:
- "DEPRECATED. Whether to use tls to connect to the docker server. Set to C(no) when TLS will not be used. Set to - "DEPRECATED. Whether to use tls to connect to the docker server. Set to
C(encrypt) to use TLS. And set to C(verify) to use TLS and verify that the server's certificate is valid for the C(encrypt) to use TLS. And set to C(verify) to use TLS and verify that
server. NOTE: If you specify this option, it will set the value of the tls or tls_verify parameters." the server's certificate is valid for the server."
- "NOTE: If you specify this option, it will set the value of the I(tls) or
I(tls_verify) parameters if not set to I(no)."
- Will be removed in Ansible 2.11.
choices: choices:
- 'no' - 'no'
- 'encrypt' - 'encrypt'
- 'verify' - 'verify'
default: 'no'
required: false required: false
version_added: "2.0" version_added: "2.0"
@ -628,7 +630,7 @@ def main():
rm=dict(type='bool', default=True), rm=dict(type='bool', default=True),
state=dict(type='str', choices=['absent', 'present', 'build'], default='present'), state=dict(type='str', choices=['absent', 'present', 'build'], default='present'),
tag=dict(type='str', default='latest'), tag=dict(type='str', default='latest'),
use_tls=dict(type='str', default='no', choices=['no', 'encrypt', 'verify']), use_tls=dict(type='str', choices=['no', 'encrypt', 'verify'], removed_in_version='2.11'),
buildargs=dict(type='dict', default=None), buildargs=dict(type='dict', default=None),
) )
@ -645,6 +647,15 @@ def main():
option_minimal_versions=option_minimal_versions, option_minimal_versions=option_minimal_versions,
) )
if client.module.params['state'] == 'build':
client.module.warn('The "build" state has been deprecated for a long time '
'and will be removed in Ansible 2.11. Please use '
'"present", which has the same meaning as "build".')
if client.module.params['use_tls']:
client.module.warn('The "use_tls" option has been deprecated for a long time '
'and will be removed in Ansible 2.11. Please use the'
'"tls" and "tls_verify" options instead.')
results = dict( results = dict(
changed=False, changed=False,
actions=[], actions=[],