From fe09516235fd38df658bcc3e8ffd6b4dfb0fd4eb Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 20:43:16 +0100 Subject: [PATCH] svc - invoke run_command passing list (#3829) (#3830) * svc - invoke run_command passing list * added changelog fragment (cherry picked from commit ccb74ffd7c54ccc8640288a9992e83325c8dc444) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/3829-svc-run-list.yaml | 2 ++ plugins/modules/system/svc.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/3829-svc-run-list.yaml diff --git a/changelogs/fragments/3829-svc-run-list.yaml b/changelogs/fragments/3829-svc-run-list.yaml new file mode 100644 index 0000000000..5a6b6d2338 --- /dev/null +++ b/changelogs/fragments/3829-svc-run-list.yaml @@ -0,0 +1,2 @@ +minor_changes: + - svc - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3829). diff --git a/plugins/modules/system/svc.py b/plugins/modules/system/svc.py index f49f904d93..53f46f0440 100644 --- a/plugins/modules/system/svc.py +++ b/plugins/modules/system/svc.py @@ -172,7 +172,7 @@ class Svc(object): self.execute_command([self.svc_cmd, '-dx', src_log]) def get_status(self): - (rc, out, err) = self.execute_command([self.svstat_cmd, self.svc_full]) + rc, out, err = self.execute_command([self.svstat_cmd, self.svc_full]) if err is not None and err: self.full_state = self.state = err @@ -223,7 +223,7 @@ class Svc(object): def execute_command(self, cmd): try: - (rc, out, err) = self.module.run_command(' '.join(cmd)) + rc, out, err = self.module.run_command(cmd) except Exception as e: self.module.fail_json(msg="failed to execute: %s" % to_native(e), exception=traceback.format_exc()) return (rc, out, err)