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)

* svc - invoke run_command passing list

* added changelog fragment
This commit is contained in:
Alexei Znamensky 2021-12-02 01:18:38 +13:00 committed by GitHub
parent ba9578f12a
commit ccb74ffd7c
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)