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)