Fix tb for when env var contains % (#83499)

Fixes #83498

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
pull/83511/head
Martin Krizek 5 months ago committed by GitHub
parent 665d2e15d7
commit a8e4106c47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- Fix a traceback when an environment variable contains certain special characters (https://github.com/ansible/ansible/issues/83498)

@ -211,7 +211,11 @@ class ShellBase(AnsiblePlugin):
arg_path,
]
return f'{env_string}%s' % self.join(cps for cp in cmd_parts if cp and (cps := cp.strip()))
cleaned_up_cmd = self.join(
stripped_cmd_part for raw_cmd_part in cmd_parts
if raw_cmd_part and (stripped_cmd_part := raw_cmd_part.strip())
)
return ''.join((env_string, cleaned_up_cmd))
def append_command(self, cmd, cmd_to_append):
"""Append an additional command if supported by the shell"""

@ -28,6 +28,7 @@
ANSIBLE_REMOTE_TMP: '{{ atd }}'
ANSIBLE_NOCOLOR: "1"
ANSIBLE_FORCE_COLOR: "0"
TEST: "foo%D"
register: command_building
delegate_to: localhost

Loading…
Cancel
Save