Skip to content

Commit 6655669

Browse files
committed
Dev: crash_test: Reuse get_node_list in xmlutil.CrmMonXmlParser
Instead of parsing text via regex
1 parent c665a16 commit 6655669

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

crmsh/crash_test/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from crmsh import log
1212
from crmsh.sh import ShellUtils
1313
from crmsh import constants
14+
from crmsh import xmlutil
1415

1516

1617
logger = log.setup_logger(__name__)
@@ -151,12 +152,7 @@ def online_nodes():
151152
"""
152153
Get online node list
153154
"""
154-
rc, stdout, stderr = ShellUtils().get_stdout_stderr('crm_mon -1')
155-
if rc == 0 and stdout:
156-
res = re.search(r'Online:\s+\[\s(.*)\s\]', stdout)
157-
if res:
158-
return res.group(1).split()
159-
return []
155+
return xmlutil.CrmMonXmlParser().get_node_list(online=True, node_type='member')
160156

161157

162158
def peer_node_list():

0 commit comments

Comments
 (0)