From b1270aa897428a4e43e25c65130c3bd05798f438 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 12 Feb 2026 03:47:45 +1000 Subject: [PATCH] Action make_tmp_path fix error (#86505) (#86513) Fixes the error to only include the command rather than the dataclass repr. This goes back to how it worked in the past before `_mkdtemp2` was added. (cherry picked from commit 2c1fdfe0eba4505251c50a0a7f3596641e966007) --- changelogs/fragments/make-tmp-path-msg.yml | 4 ++++ lib/ansible/plugins/action/__init__.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/make-tmp-path-msg.yml diff --git a/changelogs/fragments/make-tmp-path-msg.yml b/changelogs/fragments/make-tmp-path-msg.yml new file mode 100644 index 00000000000..99d061f09c9 --- /dev/null +++ b/changelogs/fragments/make-tmp-path-msg.yml @@ -0,0 +1,4 @@ +bugfixes: + - >- + Fix up the Action plugin ``_make_tmp_path`` error to only include the command run rather than the shell's dataclass + repr from ``mkdtemp``. diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 9bcba7fbe99..085b38ff1cf 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -447,7 +447,7 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin): become_user = self.get_become_option('become_user') return bool(become_user and become_user not in admin_users + [remote_user]) - def _make_tmp_path(self, remote_user=None): + def _make_tmp_path(self, remote_user: str | None = None) -> str: """ Create and return a temporary path on a remote box. """ @@ -485,7 +485,7 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin): output = ('Failed to create temporary directory. ' 'In some cases, you may have been able to authenticate and did not have permissions on the target directory. ' 'Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. ' - 'Failed command was: %s, exited with result %d' % (cmd, result['rc'])) + 'Failed command was: %s, exited with result %d' % (cmd.command, result['rc'])) if 'stdout' in result and result['stdout'] != u'': output = output + u", stdout output: %s" % result['stdout'] if display.verbosity > 3 and 'stderr' in result and result['stderr'] != u'':