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()