Skip to content

Commit d386cc4

Browse files
authored
[crmsh-4.6] Fix: cmd_status: call crm_mon without shell (#1429) (#1432)
backport: * #1430
2 parents 85681c6 + 897116f commit d386cc4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crmsh/cmd_status.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Copyright (C) 2013 Kristoffer Gronlund <kgronlund@suse.com>
22
# Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
33
# See COPYING for license information.
4-
54
import re
5+
import shlex
6+
67
from . import clidisplay
78
from . import utils
89
from .sh import ShellUtils
@@ -81,14 +82,12 @@ def crm_mon(opts=''):
8182
prog = utils.is_program("crm_mon")
8283
if not prog:
8384
raise IOError("crm_mon not available, check your installation")
84-
_, out = shell.get_stdout("%s --help" % (prog))
85+
_crm_mon = [prog, '-1']
86+
_, out = shell.get_stdout([prog, '--help'], shell=False)
8587
if "--pending" in out:
86-
_crm_mon = "%s -1 -j" % (prog)
87-
else:
88-
_crm_mon = "%s -1" % (prog)
88+
_crm_mon.append('-j')
8989

90-
status_cmd = "%s %s" % (_crm_mon, opts)
91-
return shell.get_stdout_stderr(utils.add_sudo(status_cmd))
90+
return shell.get_stdout_stderr(_crm_mon + shlex.split(opts), shell=False)
9291

9392

9493
def cmd_status(args):

0 commit comments

Comments
 (0)