From a96684ef4076d3db90f956bf2f2f7f51a33cbf32 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Tue, 5 Aug 2025 06:00:30 +1200 Subject: [PATCH] bzr: command args as list rather than string (#10523) * bzr: command args as list rather than string * add changelog frag --- changelogs/fragments/10523-bzr-cmd-list.yml | 2 ++ plugins/modules/bzr.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/10523-bzr-cmd-list.yml diff --git a/changelogs/fragments/10523-bzr-cmd-list.yml b/changelogs/fragments/10523-bzr-cmd-list.yml new file mode 100644 index 0000000000..fb6c8a6c47 --- /dev/null +++ b/changelogs/fragments/10523-bzr-cmd-list.yml @@ -0,0 +1,2 @@ +minor_changes: + - bzr - using safer mechanism to run external command (https://github.com/ansible-collections/community.general/pull/10523). diff --git a/plugins/modules/bzr.py b/plugins/modules/bzr.py index 76ae917802..d6368ce517 100644 --- a/plugins/modules/bzr.py +++ b/plugins/modules/bzr.py @@ -80,7 +80,7 @@ class Bzr(object): def get_version(self): '''samples the version of the bzr branch''' - cmd = "%s revno" % self.bzr_path + cmd = [self.bzr_path, "revno"] rc, stdout, stderr = self.module.run_command(cmd, cwd=self.dest) revno = stdout.strip() return revno @@ -100,7 +100,7 @@ class Bzr(object): def has_local_mods(self): - cmd = "%s status -S" % self.bzr_path + cmd = [self.bzr_path, "status", "-S"] rc, stdout, stderr = self.module.run_command(cmd, cwd=self.dest) lines = stdout.splitlines()