Skip to content

Commit

Permalink
Revert "Remove deprecated functionality. (#363)"
Browse files Browse the repository at this point in the history
This reverts commit 209aeb5.
  • Loading branch information
felixfontein committed Jul 2, 2022
1 parent 57e19ca commit e6d597b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
3 changes: 0 additions & 3 deletions changelogs/fragments/363-deprecations.yml

This file was deleted.

4 changes: 3 additions & 1 deletion plugins/doc_fragments/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class ModuleDocFragment(object):
- When verifying the authenticity of the Docker Host server, provide the expected name of the server.
- If the value is not specified in the task, the value of environment variable C(DOCKER_TLS_HOSTNAME) will
be used instead. If the environment variable is not set, the default value will be used.
- Note that this option had a default value C(localhost) in older versions. It was removed in community.docker 3.0.0.
- The current default value is C(localhost). This default is deprecated and will change in community.docker
2.0.0 to be a value computed from I(docker_host). Explicitly specify C(localhost) to make sure this value
will still be used, and to disable the deprecation message which will be shown otherwise.
type: str
api_version:
description:
Expand Down
5 changes: 4 additions & 1 deletion plugins/module_utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,10 @@ def auth_params(self):
use_ssh_client=self._get_value('use_ssh_client', params['use_ssh_client'], None, False),
)

update_tls_hostname(result)
def depr(*args, **kwargs):
self.deprecate(*args, **kwargs)

update_tls_hostname(result, old_behavior=True, deprecate_function=depr, uses_tls=is_using_tls(result))

return result

Expand Down
15 changes: 14 additions & 1 deletion plugins/module_utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,22 @@ def log(self, msg, pretty_print=False):

def update_tls_hostname(result, old_behavior=False, deprecate_function=None, uses_tls=True):
if result['tls_hostname'] is None:
if old_behavior:
result['tls_hostname'] = DEFAULT_TLS_HOSTNAME
if uses_tls and deprecate_function is not None:
deprecate_function(
'The default value "localhost" for tls_hostname is deprecated and will be removed in community.docker 3.0.0.'
' From then on, docker_host will be used to compute tls_hostname. If you want to keep using "localhost",'
' please set that value explicitly.',
version='3.0.0', collection_name='community.docker')
return

# get default machine name from the url
parsed_url = urlparse(result['docker_host'])
result['tls_hostname'] = parsed_url.netloc.rsplit(':', 1)[0]
if ':' in parsed_url.netloc:
result['tls_hostname'] = parsed_url.netloc[:parsed_url.netloc.rindex(':')]
else:
result['tls_hostname'] = parsed_url


def compare_dict_allow_more_present(av, bv):
Expand Down
6 changes: 6 additions & 0 deletions plugins/modules/docker_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
requirements:
- jsondiff
- pyyaml
notes:
- Return values I(out) and I(err) have been deprecated and will be removed in community.docker 3.0.0. Use I(stdout) and I(stderr) instead.
'''

RETURN = '''
Expand Down Expand Up @@ -257,6 +260,7 @@ def main():
if rc != 0:
module.fail_json(msg="docker stack up deploy command failed",
rc=rc,
out=out, err=err, # Deprecated
stdout=out, stderr=err)

before_after_differences = json_diff(before_stack_services,
Expand Down Expand Up @@ -290,10 +294,12 @@ def main():
if rc != 0:
module.fail_json(msg="'docker stack down' command failed",
rc=rc,
out=out, err=err, # Deprecated
stdout=out, stderr=err)
else:
module.exit_json(changed=True,
msg=out, rc=rc,
err=err, # Deprecated
stdout=out, stderr=err)
module.exit_json(changed=False)

Expand Down

0 comments on commit e6d597b

Please sign in to comment.