Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2019-09-30 16:02:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crmsh (Old)
 and      /work/SRC/openSUSE:Factory/.crmsh.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crmsh"

Mon Sep 30 16:02:57 2019 rev:163 rq:734026 version:4.1.0+git.1569593219.e357a9b9

Changes:
--------
--- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes      2019-09-23 
12:37:54.665605088 +0200
+++ /work/SRC/openSUSE:Factory/.crmsh.new.2352/crmsh.changes    2019-09-30 
16:03:03.100633369 +0200
@@ -1,0 +2,14 @@
+Fri Sep 27 14:09:17 UTC 2019 - [email protected]
+
+- Update to version 4.1.0+git.1569593219.e357a9b9:
+  * Fix: ui_cluster: refactor function list_cluster_nodes and handle the None 
situation(bsc#1145520)
+  
+-------------------------------------------------------------------
+Fri Sep 27 14:04:51 UTC 2019 - [email protected]
+
+- Update to version 4.1.0+git.1569593061.35f57072:
+  * High: cibconfig: Correctly sanitize the original CIB as patch base 
(bsc#1127716, bsc#1138405)
+  * Revert "high: cibconfig: Use correct CIB as patch base (bsc#1127716)"
+  * Partially revert "medium: cibconfig: Sanitize CIB for patching 
(bsc#1127716)"
+
+-------------------------------------------------------------------

Old:
----
  crmsh-4.1.0+git.1567524903.fff07b88.tar.bz2

New:
----
  crmsh-4.1.0+git.1569593219.e357a9b9.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.PBahQc/_old  2019-09-30 16:03:04.628629303 +0200
+++ /var/tmp/diff_new_pack.PBahQc/_new  2019-09-30 16:03:04.628629303 +0200
@@ -36,7 +36,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0-or-later
 Group:          %{pkg_group}
-Version:        4.1.0+git.1567524903.fff07b88
+Version:        4.1.0+git.1569593219.e357a9b9
 Release:        0
 Url:            http://crmsh.github.io
 Source0:        %{name}-%{version}.tar.bz2

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.PBahQc/_old  2019-09-30 16:03:04.660629218 +0200
+++ /var/tmp/diff_new_pack.PBahQc/_new  2019-09-30 16:03:04.664629207 +0200
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
             <param name="url">git://github.com/ClusterLabs/crmsh.git</param>
-          <param 
name="changesrevision">f01ad01a93385b981987dad29a4c7ae019bfdd6b</param></service></servicedata>
\ No newline at end of file
+          <param 
name="changesrevision">e357a9b98c697d57d5ef33b489a1b59d02dea77a</param></service></servicedata>
\ No newline at end of file

++++++ crmsh-4.1.0+git.1567524903.fff07b88.tar.bz2 -> 
crmsh-4.1.0+git.1569593219.e357a9b9.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/cibconfig.py 
new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/cibconfig.py
--- old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/cibconfig.py  2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/cibconfig.py  2019-09-27 
16:06:59.000000000 +0200
@@ -40,7 +40,7 @@
 from .xmlutil import sanity_check_nvpairs, merge_nodes, op2list, mk_rsc_type, 
is_resource
 from .xmlutil import stuff_comments, is_comment, is_constraint, read_cib, 
processing_sort_cli
 from .xmlutil import find_operation, get_rsc_children_ids, is_primitive, 
referenced_resources
-from .xmlutil import cibdump2tmp, cibdump2elem, processing_sort, 
get_rsc_ref_ids, merge_tmpl_into_prim
+from .xmlutil import cibdump2elem, processing_sort, get_rsc_ref_ids, 
merge_tmpl_into_prim
 from .xmlutil import remove_id_used_attributes, get_top_cib_nodes
 from .xmlutil import merge_attributes, is_cib_element, sanity_check_meta
 from .xmlutil import is_simpleconstraint, is_template, rmnode, is_defaults, 
is_live_cib
@@ -2680,7 +2680,8 @@
             # now increase the epoch by 1
             self.bump_epoch()
         self._set_cib_attributes(self.cib_elem)
-        tmpf = cibdump2tmp(filterfn=sanitize_cib_for_patching)
+        cib_s = xml_tostring(self.cib_orig, pretty_print=True)
+        tmpf = str2tmp(cib_s, suffix=".xml")
         if not tmpf or not ensure_sudo_readable(tmpf):
             return False
         tmpfiles.add(tmpf)
@@ -2689,6 +2690,7 @@
         # produce a diff:
         # dump_new_conf | crm_diff -o self.cib_orig -n -
 
+        common_debug("Basis: %s" % (open(tmpf).read()))
         common_debug("Input: %s" % (xml_tostring(self.cib_elem)))
         rc, cib_diff = filter_string("%s -o %s -n -" %
                                      (self._crm_diff_cmd, tmpf),
@@ -2795,9 +2797,10 @@
             cib = cibtext2elem(cib)
         if not self._import_cib(cib):
             return False
-        sanitize_cib(self.cib_elem)
         if cibadmin_can_patch():
             self.cib_orig = copy.deepcopy(self.cib_elem)
+            sanitize_cib_for_patching(self.cib_orig)
+        sanitize_cib(self.cib_elem)
         show_unrecognized_elems(self.cib_elem)
         self._populate()
         return self.check_structure()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/scripts.py 
new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/scripts.py
--- old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/scripts.py    2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/scripts.py    2019-09-27 
16:06:59.000000000 +0200
@@ -428,7 +428,7 @@
     try:
         import yaml
         with open(scriptfile) as f:
-            data = yaml.load(f)
+            data = yaml.load(f, Loader=yaml.SafeLoader)
             if isinstance(data, list):
                 data = data[0]
     except ImportError as e:
@@ -1035,7 +1035,7 @@
     build_script_cache()
     import io
     import yaml
-    data = yaml.load(io.StringIO(yml))
+    data = yaml.load(io.StringIO(yml), Loader=yaml.SafeLoader)
     if isinstance(data, list):
         data = data[0]
     if 'parameters' in data:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/ui_cluster.py 
new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/ui_cluster.py
--- old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/ui_cluster.py 2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/ui_cluster.py 2019-09-27 
16:06:59.000000000 +0200
@@ -631,7 +631,7 @@
             context.fatal_error("Timed out waiting for cluster (rc = %s)" % 
(ret))
 
     @command.skill_level('expert')
-    def do_run(self, context, cmd, node=None):
+    def do_run(self, context, cmd, *nodes):
         '''
         Execute the given command on all nodes/specific node, report outcome
         '''
@@ -644,10 +644,16 @@
         if not _has_parallax:
             context.fatal_error("python package parallax is needed for this 
command")
 
-        hosts = utils.list_cluster_nodes()
-        if node and node in hosts:
-            hosts = [node]
+        if nodes:
+            hosts = list(nodes)
+        else:
+            hosts = utils.list_cluster_nodes()
+            if hosts is None:
+                context.fatal_error("failed to get node list from cluster")
+
         opts = parallax.Options()
+        opts.ssh_options = ['StrictHostKeyChecking=no']
+        opts.askpass = utils.check_ssh_passwd_need(hosts)
         for host, result in parallax.call(hosts, cmd, opts).items():
             if isinstance(result, parallax.Error):
                 err_buf.error("[%s]: %s" % (host, result))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/utils.py 
new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/utils.py
--- old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/utils.py      2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/utils.py      2019-09-27 
16:06:59.000000000 +0200
@@ -1760,13 +1760,23 @@
         return None
 
     try:
+        # when pacemaker running
         rc, outp = stdout2list(['crm_node', '-l'], stderr_on=False, 
shell=False)
         if rc == 0:
             return [x for x in [getname(line.split()) for line in outp] if x 
and x != '(null)']
 
+        # when corosync running
+        ip_list = get_member_iplist()
+        if ip_list:
+            return ip_list
+
+        # static situation
+        cib_path = os.getenv('CIB_file', '/var/lib/pacemaker/cib/cib.xml')
+        if not os.path.isfile(cib_path):
+            return None
         from . import xmlutil
         node_list = []
-        cib = xmlutil.cibdump2elem()
+        cib = xmlutil.file2cib_elem(cib_path)
         if cib is None:
             return None
         for node in cib.xpath('/cib/configuration/nodes/node'):
@@ -2166,4 +2176,26 @@
     return datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
 
 
+def get_member_iplist():
+    rc, out, err= get_stdout_stderr("corosync-cmapctl -b 
runtime.totem.pg.mrp.srp.members")
+    if rc != 0:
+        common_debug(err)
+        return None
+
+    ip_list = []
+    for line in out.split('\n'):
+        match = re.search(r'ip\((.*?)\)', line)
+        if match:
+            ip_list.append(match.group(1))
+    return ip_list
+
+
+def check_ssh_passwd_need(hosts):
+    ssh_options = "-o StrictHostKeyChecking=no -o EscapeChar=none -o 
ConnectTimeout=15"
+    for host in hosts:
+        ssh_cmd = "ssh {} -T -o Batchmode=yes {} true".format(ssh_options, 
host)
+        rc, _, _ = get_stdout_stderr(ssh_cmd)
+        if rc != 0:
+            return True
+    return False
 # vim:ts=4:sw=4:et:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/xmlutil.py 
new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/xmlutil.py
--- old/crmsh-4.1.0+git.1567524903.fff07b88/crmsh/xmlutil.py    2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/crmsh/xmlutil.py    2019-09-27 
16:06:59.000000000 +0200
@@ -87,17 +87,9 @@
     return None
 
 
-def cibdump2tmp(filterfn=None):
+def cibdump2tmp():
     try:
         _, outp, _ = sudocall(cib_dump)
-        if filterfn is not None:
-            try:
-                cib_elem = etree.fromstring(outp)
-            except etree.ParseError as msg:
-                common_err(msg)
-                return None
-            filterfn(cib_elem)
-            outp = etree.tostring(cib_elem, pretty_print=True)
         if outp is not None:
             return str2tmp(outp)
     except IOError as msg:
@@ -675,7 +667,6 @@
 
 
 def sanitize_cib(doc):
-
     xml_processnodes(doc, is_status_node, rmnodes)
     # xml_processnodes(doc, true, printid)
     # xml_processnodes(doc, is_emptynvpairs, rmnodes)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.1.0+git.1567524903.fff07b88/doc/crm.8.adoc 
new/crmsh-4.1.0+git.1569593219.e357a9b9/doc/crm.8.adoc
--- old/crmsh-4.1.0+git.1567524903.fff07b88/doc/crm.8.adoc      2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/doc/crm.8.adoc      2019-09-27 
16:06:59.000000000 +0200
@@ -1346,18 +1346,18 @@
 ==== `run`
 
 This command takes a shell statement as argument, executes that
-statement on all nodes or a specific node in the cluster, 
+statement on all nodes in the cluster or a specific node,
 and reports the result.
 
 Usage:
 ...............
-run <command> [node]
+run <command> [node ...]
 ...............
 
 Example:
 ...............
 run "cat /proc/uptime" 
-run "ls" node2 
+run "ls" node1 node2
 ...............
 
 [[cmdhelp_cluster_start,Start cluster services]]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/edit 
new/crmsh-4.1.0+git.1569593219.e357a9b9/test/testcases/edit
--- old/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/edit 2019-09-03 
17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/test/testcases/edit 2019-09-27 
16:06:59.000000000 +0200
@@ -62,6 +62,34 @@
 tag t-d45: d4 d5
 show type:order
 show related:d4
+show
+commit
+_test
+verify
+primitive a0 ocf:heartbeat:Dummy
+primitive a1 ocf:heartbeat:Dummy
+primitive a2 ocf:heartbeat:Dummy
+primitive a3 ocf:heartbeat:Dummy
+primitive a4 ocf:heartbeat:Dummy
+primitive a5 ocf:heartbeat:Dummy
+primitive a6 ocf:heartbeat:Dummy
+primitive a7 ocf:heartbeat:Dummy
+primitive a8 ocf:heartbeat:Dummy
+primitive a9 ocf:heartbeat:Dummy
+primitive aErr ocf:heartbeat:Dummy
+group as a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aErr
+commit
+cd ..
+cd configure
+filter "sed '/as/s/a9//'"
+filter "sed '/as/s/a1/a1 a9/'"
+commit
+cd ..
+cd configure
+filter "sed '/abs/s/a9//'"
+filter "sed '/abs/s/a8/a8 a9/'"
+show
+commit
 _test
 verify
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/edit.exp 
new/crmsh-4.1.0+git.1569593219.e357a9b9/test/testcases/edit.exp
--- old/crmsh-4.1.0+git.1567524903.fff07b88/test/testcases/edit.exp     
2019-09-03 17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/test/testcases/edit.exp     
2019-09-27 16:06:59.000000000 +0200
@@ -127,14 +127,135 @@
 primitive d4 Dummy
 tag t-d45 d4 d5
 order o-d456 d4 d5 d6
-.INP: _test
-.INP: verify
+.INP: show
+node node1 \
+       attributes mem=16G
+primitive d1 Dummy
+primitive d2 Dummy
+primitive d3 Dummy
+primitive d4 Dummy
+primitive d5 Dummy
+primitive d6 Dummy
+primitive p1 Dummy \
+       op monitor interval=60m \
+       op monitor interval=120m \
+       op_params OCF_CHECK_LEVEL=10
+primitive p2 Dummy
+primitive p3 Dummy
+primitive st stonith:null \
+       params hostlist=node1 \
+       meta description="some description here" requires=nothing \
+       op monitor interval=60m
+group g1 p1 p2 d3
+group g2 d1 d2
+clone c1 g1
+tag t-d45 d4 d5
+location l1 p3 100: node1
+location loc-d1 d1 \
+       rule -inf: not_defined webserver or mem number:lte 0 \
+       rule -inf: not_defined a2 \
+       rule webserver: defined webserver
+order o-d456 d4 d5 d6
+order o1 inf: p3 c1
+property cib-bootstrap-options:
+rsc_defaults rsc_options: \
+       failure-timeout=10m
+op_defaults op-options: \
+       timeout=60s
+.INP: commit
 .EXT crmd metadata
 .EXT pengine metadata
 .EXT cib metadata
+.INP: _test
+.INP: verify
+.INP: primitive a0 ocf:heartbeat:Dummy
+.INP: primitive a1 ocf:heartbeat:Dummy
+.INP: primitive a2 ocf:heartbeat:Dummy
+.INP: primitive a3 ocf:heartbeat:Dummy
+.INP: primitive a4 ocf:heartbeat:Dummy
+.INP: primitive a5 ocf:heartbeat:Dummy
+.INP: primitive a6 ocf:heartbeat:Dummy
+.INP: primitive a7 ocf:heartbeat:Dummy
+.INP: primitive a8 ocf:heartbeat:Dummy
+.INP: primitive a9 ocf:heartbeat:Dummy
+.INP: primitive aErr ocf:heartbeat:Dummy
+.INP: group as a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aErr
+.INP: commit
+.INP: cd ..
+.INP: cd configure
+.INP: filter "sed '/as/s/a9//'"
+.INP: filter "sed '/as/s/a1/a1 a9/'"
+.INP: commit
+.INP: cd ..
+.INP: cd configure
+.INP: filter "sed '/abs/s/a9//'"
+.INP: filter "sed '/abs/s/a8/a8 a9/'"
+.INP: show
+node node1 \
+       attributes mem=16G
+primitive a0 Dummy
+primitive a1 Dummy
+primitive a2 Dummy
+primitive a3 Dummy
+primitive a4 Dummy
+primitive a5 Dummy
+primitive a6 Dummy
+primitive a7 Dummy
+primitive a8 Dummy
+primitive a9 Dummy
+primitive aErr Dummy
+primitive d1 Dummy
+primitive d2 Dummy
+primitive d3 Dummy
+primitive d4 Dummy
+primitive d5 Dummy
+primitive d6 Dummy
+primitive p1 Dummy \
+       op monitor interval=60m \
+       op monitor interval=120m \
+       op_params OCF_CHECK_LEVEL=10
+primitive p2 Dummy
+primitive p3 Dummy
+primitive st stonith:null \
+       params hostlist=node1 \
+       meta description="some description here" requires=nothing \
+       op monitor interval=60m
+group as a0 a1 a9 a2 a3 a4 a5 a6 a7 a8 aErr
+group g1 p1 p2 d3
+group g2 d1 d2
+clone c1 g1
+tag t-d45 d4 d5
+location l1 p3 100: node1
+location loc-d1 d1 \
+       rule -inf: not_defined webserver or mem number:lte 0 \
+       rule -inf: not_defined a2 \
+       rule webserver: defined webserver
+order o-d456 d4 d5 d6
+order o1 inf: p3 c1
+property cib-bootstrap-options:
+rsc_defaults rsc_options: \
+       failure-timeout=10m
+op_defaults op-options: \
+       timeout=60s
+.INP: commit
+INFO: 89: apparently there is nothing to commit
+INFO: 89: try changing something first
+.INP: _test
+.INP: verify
 .INP: show
 node node1 \
        attributes mem=16G
+primitive a0 Dummy
+primitive a1 Dummy
+primitive a2 Dummy
+primitive a3 Dummy
+primitive a4 Dummy
+primitive a5 Dummy
+primitive a6 Dummy
+primitive a7 Dummy
+primitive a8 Dummy
+primitive a9 Dummy
+primitive aErr Dummy
 primitive d1 Dummy
 primitive d2 Dummy
 primitive d3 Dummy
@@ -151,6 +272,7 @@
        params hostlist=node1 \
        meta description="some description here" requires=nothing \
        op monitor interval=60m
+group as a0 a1 a9 a2 a3 a4 a5 a6 a7 a8 aErr
 group g1 p1 p2 d3
 group g2 d1 d2
 clone c1 g1
@@ -168,3 +290,5 @@
 op_defaults op-options: \
        timeout=60s
 .INP: commit
+INFO: 93: apparently there is nothing to commit
+INFO: 93: try changing something first
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.1.0+git.1567524903.fff07b88/test/unittests/test_utils.py 
new/crmsh-4.1.0+git.1569593219.e357a9b9/test/unittests/test_utils.py
--- old/crmsh-4.1.0+git.1567524903.fff07b88/test/unittests/test_utils.py        
2019-09-03 17:35:03.000000000 +0200
+++ new/crmsh-4.1.0+git.1569593219.e357a9b9/test/unittests/test_utils.py        
2019-09-27 16:06:59.000000000 +0200
@@ -12,6 +12,70 @@
 from crmsh import tmpfiles
 
 
+def test_check_ssh_passwd_need_True():
+    with mock.patch('crmsh.utils.get_stdout_stderr') as mock_get_stdout_stderr:
+        mock_get_stdout_stderr.side_effect = [(0, None, None), (1, None, None)]
+        assert utils.check_ssh_passwd_need(["node1", "node2"]) == True
+    mock_get_stdout_stderr.assert_has_calls([
+            mock.call('ssh -o StrictHostKeyChecking=no -o EscapeChar=none -o 
ConnectTimeout=15 -T -o Batchmode=yes node1 true'),
+            mock.call('ssh -o StrictHostKeyChecking=no -o EscapeChar=none -o 
ConnectTimeout=15 -T -o Batchmode=yes node2 true')
+        ])
+
+
+def test_check_ssh_passwd_need_Flase():
+    with mock.patch('crmsh.utils.get_stdout_stderr') as mock_get_stdout_stderr:
+        mock_get_stdout_stderr.side_effect = [(0, None, None), (0, None, None)]
+        assert utils.check_ssh_passwd_need(["node1", "node2"]) == False
+    mock_get_stdout_stderr.assert_has_calls([
+            mock.call('ssh -o StrictHostKeyChecking=no -o EscapeChar=none -o 
ConnectTimeout=15 -T -o Batchmode=yes node1 true'),
+            mock.call('ssh -o StrictHostKeyChecking=no -o EscapeChar=none -o 
ConnectTimeout=15 -T -o Batchmode=yes node2 true')
+        ])
+
+
[email protected]('crmsh.utils.common_debug')
[email protected]('crmsh.utils.get_stdout_stderr')
+def test_get_member_iplist_None(mock_get_stdout_stderr, mock_common_debug):
+    mock_get_stdout_stderr.return_value = (1, None, "Failed to initialize the 
cmap API. Error CS_ERR_LIBRARY")
+    assert utils.get_member_iplist() is None
+    mock_get_stdout_stderr.assert_called_once_with('corosync-cmapctl -b 
runtime.totem.pg.mrp.srp.members')
+    mock_common_debug.assert_called_once_with('Failed to initialize the cmap 
API. Error CS_ERR_LIBRARY')
+
+
+def test_get_member_iplist():
+    with mock.patch('crmsh.utils.get_stdout_stderr') as mock_get_stdout_stderr:
+        cmap_value = '''
+runtime.totem.pg.mrp.srp.members.336860211.config_version (u64) = 0
+runtime.totem.pg.mrp.srp.members.336860211.ip (str) = r(0) ip(20.20.20.51)
+runtime.totem.pg.mrp.srp.members.336860211.join_count (u32) = 1
+runtime.totem.pg.mrp.srp.members.336860211.status (str) = joined
+runtime.totem.pg.mrp.srp.members.336860212.config_version (u64) = 0
+runtime.totem.pg.mrp.srp.members.336860212.ip (str) = r(0) ip(20.20.20.52)
+runtime.totem.pg.mrp.srp.members.336860212.join_count (u32) = 1
+runtime.totem.pg.mrp.srp.members.336860212.status (str) = joined
+        '''
+        mock_get_stdout_stderr.return_value = (0, cmap_value, None)
+        assert utils.get_member_iplist() == ['20.20.20.51', '20.20.20.52']
+    mock_get_stdout_stderr.assert_called_once_with('corosync-cmapctl -b 
runtime.totem.pg.mrp.srp.members')
+
+
+def test_list_cluster_nodes_pacemaker_running():
+    with mock.patch('crmsh.utils.stdout2list') as mock_stdout2list:
+        crm_node_value= ["336860211 15sp1-1 member", "336860212 15sp1-2 
member"]
+        mock_stdout2list.return_value = (0, crm_node_value)
+        assert utils.list_cluster_nodes() == ['15sp1-1', '15sp1-2']
+    mock_stdout2list.assert_called_once_with(['crm_node', '-l'], shell=False, 
stderr_on=False)
+
+
[email protected]('crmsh.utils.stdout2list')
[email protected]('crmsh.utils.get_member_iplist')
+def test_list_cluster_nodes_corosync_running(mock_get_member_iplist, 
mock_stdout2list):
+    mock_stdout2list.return_value = (1, None)
+    mock_get_member_iplist.return_value = ["node1", "node2"]
+    assert utils.list_cluster_nodes() == ["node1", "node2"]
+    mock_stdout2list.assert_called_once_with(['crm_node', '-l'], shell=False, 
stderr_on=False)
+    mock_get_member_iplist.assert_called_once_with()
+
+
 def test_to_ascii():
     assert utils.to_ascii(None) is None
     assert utils.to_ascii('test') == 'test'


Reply via email to