Skip to content

Commit c665a16

Browse files
committed
Dev: utils: Reuse methods in xmlutil.CrmMonXmlParser
Drop functions `has_resource_configured` and `is_resource_running`
1 parent 2b481a7 commit c665a16

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

crmsh/utils.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,31 +2731,14 @@ def is_dlm_running(peer=None):
27312731
"""
27322732
Check if dlm ra controld is running
27332733
"""
2734-
return is_resource_running(constants.DLM_CONTROLD_RA, peer=peer)
2735-
2736-
2737-
def has_resource_configured(ra_type, peer=None):
2738-
"""
2739-
Check if the RA configured
2740-
"""
2741-
out = sh.cluster_shell().get_stdout_or_raise_error("crm_mon -1rR", peer)
2742-
return re.search(ra_type, out) is not None
2743-
2744-
2745-
def is_resource_running(ra_type, peer=None):
2746-
"""
2747-
Check if the RA running
2748-
"""
2749-
out = sh.cluster_shell().get_stdout_or_raise_error("crm_mon -1rR", peer)
2750-
patt = f"\\({ra_type}\\):\\s*Started"
2751-
return re.search(patt, out) is not None
2734+
return xmlutil.CrmMonXmlParser(peer).is_resource_started(constants.DLM_CONTROLD_RA)
27522735

27532736

27542737
def is_dlm_configured(peer=None):
27552738
"""
27562739
Check if dlm configured
27572740
"""
2758-
return has_resource_configured(constants.DLM_CONTROLD_RA, peer=peer)
2741+
return xmlutil.CrmMonXmlParser(peer).is_resource_configured(constants.DLM_CONTROLD_RA)
27592742

27602743

27612744
def is_quorate(peer=None):

0 commit comments

Comments
 (0)