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:
parent
ba9578f12a
commit
ccb74ffd7c
2 changed files with 4 additions and 2 deletions
2
changelogs/fragments/3829-svc-run-list.yaml
Normal file
2
changelogs/fragments/3829-svc-run-list.yaml
Normal 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).
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue