Open
Description
When running host.podman.get_containers()
, podman generates the following command that is run:
podman ps --all --format {{.Names}}
The Ansible providers interprets the {{
as the start of a jinja2 template, and thus tries to interpet it, which fails with:
self = <testinfra.backend.ansible.AnsibleBackend object at 0x7f4af339e7d0>
command = "podman ps --all --format '{{.Names}}'", args = (), kwargs = {}
host = None
out = {'msg': "template error while templating string: unexpected '.'. String: podman ps --all --format '{{.Names}}'. unexpected '.'"}
def run(self, command, *args, **kwargs):
command = self.get_command(command, *args)
if not self.force_ansible:
host = self.ansible_runner.get_host(
self.host,
ssh_config=self.ssh_config,
ssh_identity_file=self.ssh_identity_file,
)
if host is not None:
return host.run(command)
out = self.run_ansible("shell", module_args=command, check=False)
return self.result(
> out["rc"],
command,
stdout_bytes=None,
stderr_bytes=None,
stdout=out["stdout"],
stderr=out["stderr"],
)
E KeyError: 'rc'
In the meantime, host.run("podman ps --all --format '{{ '{{' }}.Names{{ '}}' }}'")
works, but is a bit more manual.
I would be happy to provide a fix, but I am unsure how best to do this, given that in other cases, interpolation is what is wanted
Metadata
Metadata
Assignees
Labels
No labels