Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2023-03-07 16:50:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crmsh (Old)
 and      /work/SRC/openSUSE:Factory/.crmsh.new.31432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crmsh"

Tue Mar  7 16:50:27 2023 rev:284 rq:1069777 version:4.4.1+20230307.daea9d13

Changes:
--------
--- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes      2023-03-06 
18:56:27.848944154 +0100
+++ /work/SRC/openSUSE:Factory/.crmsh.new.31432/crmsh.changes   2023-03-07 
16:50:53.389759978 +0100
@@ -1,0 +2,6 @@
+Tue Mar 07 02:12:59 UTC 2023 - xli...@suse.com
+
+- Update to version 4.4.1+20230307.daea9d13:
+  * Fix: report: Fix crm report issue under non-root user
+
+-------------------------------------------------------------------

Old:
----
  crmsh-4.4.1+20230306.0f04eb29.tar.bz2

New:
----
  crmsh-4.4.1+20230307.daea9d13.tar.bz2

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

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.ZYkHDx/_old  2023-03-07 16:50:54.521765947 +0100
+++ /var/tmp/diff_new_pack.ZYkHDx/_new  2023-03-07 16:50:54.525765968 +0100
@@ -36,7 +36,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0-or-later
 Group:          %{pkg_group}
-Version:        4.4.1+20230306.0f04eb29
+Version:        4.4.1+20230307.daea9d13
 Release:        0
 URL:            http://crmsh.github.io
 Source0:        %{name}-%{version}.tar.bz2

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.ZYkHDx/_old  2023-03-07 16:50:54.577766242 +0100
+++ /var/tmp/diff_new_pack.ZYkHDx/_new  2023-03-07 16:50:54.577766242 +0100
@@ -9,7 +9,7 @@
 </service>
 <service name="tar_scm">
   <param name="url">https://github.com/ClusterLabs/crmsh.git</param>
-  <param 
name="changesrevision">1ea4e0874c84a6a5d03ee88465144ee72b81fe34</param>
+  <param 
name="changesrevision">3b0a582ed4f2b9de2e74d86bfdd6bf7e2ca44511</param>
 </service>
 </servicedata>
 (No newline at EOF)

++++++ crmsh-4.4.1+20230306.0f04eb29.tar.bz2 -> 
crmsh-4.4.1+20230307.daea9d13.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.4.1+20230306.0f04eb29/crmsh/report/constants.py 
new/crmsh-4.4.1+20230307.daea9d13/crmsh/report/constants.py
--- old/crmsh-4.4.1+20230306.0f04eb29/crmsh/report/constants.py 2023-03-06 
06:03:06.000000000 +0100
+++ new/crmsh-4.4.1+20230307.daea9d13/crmsh/report/constants.py 2023-03-07 
02:41:16.000000000 +0100
@@ -50,7 +50,7 @@
 SLAVE = 0
 SLAVEPIDS = None
 SSH_OPTS = "-o StrictHostKeyChecking=no -o EscapeChar=none -o 
ConnectTimeout=15"
-SSH_PASSWORD_NODES = ""
+SSH_PASSWORD_NODES = []
 SSH_USER = ""
 SUDO = ""
 THIS_IS_NODE = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.4.1+20230306.0f04eb29/crmsh/report/core.py 
new/crmsh-4.4.1+20230307.daea9d13/crmsh/report/core.py
--- old/crmsh-4.4.1+20230306.0f04eb29/crmsh/report/core.py      2023-03-06 
06:03:06.000000000 +0100
+++ new/crmsh-4.4.1+20230307.daea9d13/crmsh/report/core.py      2023-03-07 
02:41:16.000000000 +0100
@@ -24,7 +24,7 @@
     """
     process_list = []
     for node in nodes.split():
-        if utillib.node_needs_pwd(node):
+        if node in constants.SSH_PASSWORD_NODES:
             logger.info("Please provide password for %s at %s", 
utillib.say_ssh_user(), node)
             logger.info("Note that collecting data will take a while.")
             utillib.start_slave_collector(node, arg_str)
@@ -267,17 +267,6 @@
             # if the ssh user was supplied, consider that it
             # works; helps reduce the number of ssh invocations
             utillib.find_ssh_user()
-            if constants.SSH_USER:
-                constants.SSH_OPTS += " -o User=%s" % constants.SSH_USER
-        # assume that only root can collect data
-        if ((not constants.SSH_USER) and (os.getuid() not in [0, 90])) or \
-           constants.SSH_USER and constants.SSH_USER not in ["root", 
"hacluster"] or \
-           userdir.get_sudoer():
-            logger.debug("ssh user other than root, use sudo")
-            constants.SUDO = "sudo"
-        if os.getuid() != 0:
-            logger.debug("local user other than root, use sudo")
-            constants.LOCAL_SUDO = "sudo -u root"
 
     #
     # find the logs and cut out the segment for the period
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.4.1+20230306.0f04eb29/crmsh/report/utillib.py 
new/crmsh-4.4.1+20230307.daea9d13/crmsh/report/utillib.py
--- old/crmsh-4.4.1+20230306.0f04eb29/crmsh/report/utillib.py   2023-03-06 
06:03:06.000000000 +0100
+++ new/crmsh-4.4.1+20230307.daea9d13/crmsh/report/utillib.py   2023-03-07 
02:41:16.000000000 +0100
@@ -321,7 +321,7 @@
             if dump_logset(l, constants.FROM_TIME, constants.TO_TIME, outf):
                 log_size(l, outf+'.info')
         else:
-            logger.warning("could not figure out the log format of %s", l)
+            logger.debug("could not figure out the log format of %s", l)
 
 
 def collect_journal(from_t, to_t, outf):
@@ -623,43 +623,37 @@
 
 
 def find_ssh_user():
-    ssh_user = "__undef"
-    if not constants.SSH_USER:
-        try_user_str = "__default " + constants.TRY_SSH
-    else:
-        try_user_str = constants.SSH_USER
-
+    ssh_user = ""
+    ssh_user_try_list = []
+    if constants.SSH_USER:
+        ssh_user_try_list.append(constants.SSH_USER)
     sudoer = userdir.get_sudoer()
     if sudoer:
-        try_user_str = f"{sudoer} {try_user_str}"
+        ssh_user_try_list.append(sudoer)
+    current_user = userdir.getuser()
+    ssh_user_try_list.append(current_user)
 
     for n in constants.NODES.split():
-        rc = 1
         if n == constants.WE:
             continue
-        for u in try_user_str.split():
-            if u != '__default':
-                ssh_s = '@'.join((u, n))
-            else:
-                ssh_s = n
-
-            if test_ssh_conn(ssh_s):
+        rc = False
+        for u in ssh_user_try_list:
+            ssh_s = f"{u}@{n}"
+            if not crmutils.check_ssh_passwd_need(u, u, n):
                 logger.debug("ssh %s OK", ssh_s)
                 ssh_user = u
-                try_user_str = u
-                rc = 0
+                rc = True
                 break
             else:
                 logger.debug("ssh %s failed", ssh_s)
-        if rc == 1:
-            constants.SSH_PASSWORD_NODES += " %s" % n
+        if not rc:
+            constants.SSH_PASSWORD_NODES.append(n)
 
     if constants.SSH_PASSWORD_NODES:
         logger.warning("passwordless ssh to node(s) %s does not work", 
constants.SSH_PASSWORD_NODES)
-    if ssh_user == "__undef":
-        return
-    if ssh_user != "__default":
-        constants.SSH_USER = ssh_user
+    if ssh_user:
+        constants.SUDO = "" if ssh_user in ["root", "hacluster"] else "sudo"
+    constants.SSH_USER = ssh_user if ssh_user else ""
 
 
 def findln_by_time(data, ts):
@@ -1123,13 +1117,6 @@
     crmutils.str2file(out_string, os.path.join(workdir, 
constants.DESCRIPTION_F))
 
 
-def node_needs_pwd(node):
-    for n in constants.SSH_PASSWORD_NODES.split():
-        if n == node:
-            return True
-    return False
-
-
 def pe_to_dot(pe_file):
     dotf = '.'.join(pe_file.split('.')[:-1]) + '.dot'
     cmd = "%s -D %s -x %s" % (constants.PTEST, dotf, pe_file)
@@ -1371,12 +1358,11 @@
             cmd += " {}".format(str(item))
         _, out = crmutils.get_stdout(cmd)
     else:
-        sudoer = userdir.get_sudoer()
-        node = f"{sudoer}@{node}" if sudoer else node
+        node = f"{constants.SSH_USER}@{node}" if constants.SSH_USER else node
         cmd = r'ssh {} {} "{} {}"'.format(constants.SSH_OPTS, node, 
constants.SUDO, cmd)
         for item in arg_str.split():
             cmd += " {}".format(str(item))
-        code, out, err = crmutils.get_stdout_stderr(cmd)
+        code, out, err = crmutils.su_get_stdout_stderr(constants.SSH_USER, cmd)
         if code != 0:
             logger.warning(err)
             for ip in get_peer_ip():
@@ -1410,15 +1396,6 @@
     return indata.split('\n')[-n:]
 
 
-def test_ssh_conn(addr):
-    cmd = r"ssh %s -T -o Batchmode=yes %s true" % (constants.SSH_OPTS, addr)
-    code, _ = get_command_info(cmd)
-    if code == 0:
-        return True
-    else:
-        return False
-
-
 def dump_D_process():
     '''
     dump D-state process stack

Reply via email to