1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

svc - invoke run_command passing list (#3829) (#3830)

* svc - invoke run_command passing list

* added changelog fragment

(cherry picked from commit ccb74ffd7c)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-12-01 20:43:16 +01:00 committed by GitHub
parent 78cd8886f4
commit fe09516235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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).

View file

@ -172,7 +172,7 @@ class Svc(object):
self.execute_command([self.svc_cmd, '-dx', src_log]) self.execute_command([self.svc_cmd, '-dx', src_log])
def get_status(self): 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: if err is not None and err:
self.full_state = self.state = err self.full_state = self.state = err
@ -223,7 +223,7 @@ class Svc(object):
def execute_command(self, cmd): def execute_command(self, cmd):
try: try:
(rc, out, err) = self.module.run_command(' '.join(cmd)) rc, out, err = self.module.run_command(cmd)
except Exception as e: except Exception as e:
self.module.fail_json(msg="failed to execute: %s" % to_native(e), exception=traceback.format_exc()) self.module.fail_json(msg="failed to execute: %s" % to_native(e), exception=traceback.format_exc())
return (rc, out, err) return (rc, out, err)