diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-25 02:51:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-25 02:51:10 +0000 |
commit | eee9982be19a16d860b7e9dde05850e7f8c2276a (patch) | |
tree | 21d77352ca156d2d5671ffcdc88a65d4f7fb97b0 /lib/ansible/plugins | |
parent | Releasing progress-linux version 2.16.5-1~progress7.99u1. (diff) | |
download | ansible-core-eee9982be19a16d860b7e9dde05850e7f8c2276a.tar.xz ansible-core-eee9982be19a16d860b7e9dde05850e7f8c2276a.zip |
Merging upstream version 2.16.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/ansible/plugins')
-rw-r--r-- | lib/ansible/plugins/action/fetch.py | 4 | ||||
-rw-r--r-- | lib/ansible/plugins/cache/__init__.py | 1 | ||||
-rw-r--r-- | lib/ansible/plugins/connection/winrm.py | 16 | ||||
-rw-r--r-- | lib/ansible/plugins/strategy/free.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/strategy/linear.py | 2 |
5 files changed, 21 insertions, 4 deletions
diff --git a/lib/ansible/plugins/action/fetch.py b/lib/ansible/plugins/action/fetch.py index 11c91eb..d057ed2 100644 --- a/lib/ansible/plugins/action/fetch.py +++ b/lib/ansible/plugins/action/fetch.py @@ -150,6 +150,10 @@ class ActionModule(ActionBase): # destination filename base = os.path.basename(source_local) dest = os.path.join(dest, base) + + if os.path.isdir(to_bytes(dest, errors='surrogate_or_strict')): + raise AnsibleActionFail( + f"calculated dest '{dest}' is an existing directory, use another path that does not point to an existing directory") if not dest.startswith("/"): # if dest does not start with "/", we'll assume a relative path dest = self._loader.path_dwim(dest) diff --git a/lib/ansible/plugins/cache/__init__.py b/lib/ansible/plugins/cache/__init__.py index f3abcb7..24f4e77 100644 --- a/lib/ansible/plugins/cache/__init__.py +++ b/lib/ansible/plugins/cache/__init__.py @@ -165,6 +165,7 @@ class BaseFileCacheModule(BaseCacheModule): display.warning("error in '%s' cache plugin while trying to write to '%s' : %s" % (self.plugin_name, tmpfile_path, to_bytes(e))) try: os.rename(tmpfile_path, cachefile) + os.chmod(cachefile, mode=0o644) except (OSError, IOError) as e: display.warning("error in '%s' cache plugin while trying to move '%s' to '%s' : %s" % (self.plugin_name, tmpfile_path, cachefile, to_bytes(e))) finally: diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index 7104369..b297495 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -199,7 +199,7 @@ from ansible.utils.display import Display try: import winrm - from winrm.exceptions import WinRMError, WinRMOperationTimeoutError + from winrm.exceptions import WinRMError, WinRMOperationTimeoutError, WinRMTransportError from winrm.protocol import Protocol import requests.exceptions HAS_WINRM = True @@ -684,7 +684,19 @@ class Connection(ConnectionBase): raise AnsibleConnectionFailure('winrm connection error: %s' % to_native(exc)) finally: if command_id: - self.protocol.cleanup_command(self.shell_id, command_id) + # Due to a bug in how pywinrm works with message encryption we + # ignore a 400 error which can occur when a task timeout is + # set and the code tries to clean up the command. This happens + # as the cleanup msg is sent over a new socket but still uses + # the already encrypted payload bound to the other socket + # causing the server to reply with 400 Bad Request. + try: + self.protocol.cleanup_command(self.shell_id, command_id) + except WinRMTransportError as e: + if e.code != 400: + raise + + display.warning("Failed to cleanup running WinRM command, resources might still be in use on the target server") def _connect(self) -> Connection: diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py index 82a21b1..5e64ef3 100644 --- a/lib/ansible/plugins/strategy/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -177,7 +177,7 @@ class StrategyModule(StrategyBase): # role which has already run (and whether that role allows duplicate execution) if not isinstance(task, Handler) and task._role: role_obj = self._get_cached_role(task, iterator._play) - if role_obj.has_run(host) and role_obj._metadata.allow_duplicates is False: + if role_obj.has_run(host) and task._role._metadata.allow_duplicates is False: display.debug("'%s' skipped because role has already run" % task, host=host_name) del self._blocked_hosts[host_name] continue diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py index 2fd4cba..f3b117b 100644 --- a/lib/ansible/plugins/strategy/linear.py +++ b/lib/ansible/plugins/strategy/linear.py @@ -172,7 +172,7 @@ class StrategyModule(StrategyBase): # role which has already run (and whether that role allows duplicate execution) if not isinstance(task, Handler) and task._role: role_obj = self._get_cached_role(task, iterator._play) - if role_obj.has_run(host) and role_obj._metadata.allow_duplicates is False: + if role_obj.has_run(host) and task._role._metadata.allow_duplicates is False: display.debug("'%s' skipped because role has already run" % task) continue |