Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2024-03-13 22:21:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crmsh (Old)
 and      /work/SRC/openSUSE:Factory/.crmsh.new.1770 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crmsh"

Wed Mar 13 22:21:08 2024 rev:326 rq:1157633 version:4.6.0+20240313.8278d949

Changes:
--------
--- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes      2024-03-03 
20:20:06.939554675 +0100
+++ /work/SRC/openSUSE:Factory/.crmsh.new.1770/crmsh.changes    2024-03-13 
22:22:26.700827362 +0100
@@ -1,0 +2,25 @@
+Wed Mar 13 14:26:02 UTC 2024 - xli...@suse.com
+
+- Update to version 4.6.0+20240313.8278d949:
+  * Fix: utils: set env `CIB_shadow` using `os.environ` (bsc#1205925)
+  * Fix: pass env to child process explicitly (bsc#1205925)
+  * Fix: term: unset env `COLUMNS` and `ROWS` (bsc#1205925)
+  * Dev: unittest: update unit tests for previous changes
+  * Fix: sh: pass env to child process explicitly (bsc#1205925)
+
+-------------------------------------------------------------------
+Wed Mar 13 10:43:31 UTC 2024 - xli...@suse.com
+
+- Update to version 4.6.0+20240313.0c382be4:
+  * Dev: sh: Fix typo in docstring
+
+-------------------------------------------------------------------
+Tue Mar 12 07:04:54 UTC 2024 - xli...@suse.com
+
+- Update to version 4.6.0+20240312.24df92aa:
+  * Dev: unittest: Adjust unit test for previous change
+  * Fix: bootstrap: Remove unused -i option when calling csync2_remote and 
ssh_remote stage (bsc#1212080)
+  * Dev: unitest: Adjust unit test for previous change
+  * Fix: report: Show different perspectives of cluster
+
+-------------------------------------------------------------------

Old:
----
  crmsh-4.6.0+20240227.21cbb9ee.tar.bz2

New:
----
  crmsh-4.6.0+20240313.8278d949.tar.bz2

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

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.nkNuWm/_old  2024-03-13 22:22:27.312849951 +0100
+++ /var/tmp/diff_new_pack.nkNuWm/_new  2024-03-13 22:22:27.312849951 +0100
@@ -36,7 +36,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0-or-later
 Group:          %{pkg_group}
-Version:        4.6.0+20240227.21cbb9ee
+Version:        4.6.0+20240313.8278d949
 Release:        0
 URL:            http://crmsh.github.io
 Source0:        %{name}-%{version}.tar.bz2

++++++ _service ++++++
--- /var/tmp/diff_new_pack.nkNuWm/_old  2024-03-13 22:22:27.340850984 +0100
+++ /var/tmp/diff_new_pack.nkNuWm/_new  2024-03-13 22:22:27.344851132 +0100
@@ -4,7 +4,7 @@
     <param name="scm">git</param>
     <param name="filename">crmsh</param>
     <param name="versionformat">@PARENT_TAG@+%cd.%h</param>
-    <param name="versionrewrite-pattern">(\d+\.\d+\.\d+)(?:-rc\d+)?(.*)</param>
+    <param 
name="versionrewrite-pattern">(\d+\.\d+\.\d+)(?:-[a-z]+\d*)?(.*)</param>
     <param name="versionrewrite-replacement">\1\2</param>
     <param name="revision">crmsh-4.6</param>
     <param name="changesgenerate">enable</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.nkNuWm/_old  2024-03-13 22:22:27.364851870 +0100
+++ /var/tmp/diff_new_pack.nkNuWm/_new  2024-03-13 22:22:27.368852017 +0100
@@ -9,7 +9,7 @@
 </service>
 <service name="tar_scm">
   <param name="url">https://github.com/ClusterLabs/crmsh.git</param>
-  <param 
name="changesrevision">3bb63a078a6a1b93aff92c888cdb257db94310d7</param>
+  <param 
name="changesrevision">8278d9498f904df34feebd387225eecd2cca21f4</param>
 </service>
 </servicedata>
 (No newline at EOF)

++++++ crmsh-4.6.0+20240227.21cbb9ee.tar.bz2 -> 
crmsh-4.6.0+20240313.8278d949.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/bootstrap.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/bootstrap.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/bootstrap.py        2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/bootstrap.py        2024-03-13 
14:56:37.000000000 +0100
@@ -1767,8 +1767,8 @@
     if not ssh_public_keys:
         local_shell.get_stdout_or_raise_error(
             local_user,
-            "ssh {} {}@{} sudo crm cluster init -i {} ssh_remote".format(
-                SSH_OPTION, seed_user, seed_host, _context.default_nic_list[0],
+            "ssh {} {}@{} sudo crm cluster init ssh_remote".format(
+                SSH_OPTION, seed_user, seed_host
             ),
         )
     user_by_host = utils.HostUserConfig()
@@ -1882,7 +1882,7 @@
     # If we *were* updating /etc/hosts, the next line would have 
"\"$hosts_line\"" as
     # the last arg (but this requires re-enabling this functionality in 
ha-cluster-init)
     shell = sh.cluster_shell()
-    cmd = "crm cluster init -i {} csync2_remote 
{}".format(_context.default_nic_list[0], utils.this_node())
+    cmd = "crm cluster init csync2_remote {}".format(utils.this_node())
     shell.get_stdout_or_raise_error(cmd, seed_host)
 
     # This is necessary if syncing /etc/hosts (to ensure everyone's got the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/report/collect.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/report/collect.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/report/collect.py   2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/report/collect.py   2024-03-13 
14:56:37.000000000 +0100
@@ -329,8 +329,26 @@
     Dump runtime state files
     """
     cluster_shell_inst = sh.cluster_shell()
+
+    # Dump the output of 'crm_mon' command with multiple options
+    out = ""
+    for option, desc in [
+        ("-r1", "inactive resources"),
+        ("-n1", "resources grouped by node"),
+        ("-rf1", "resource fail counts"),
+        ("-rnt1", "resource operation history with timing details"),
+    ]:
+        cmd = f"crm_mon {option}"
+        out += f"\n#### Display cluster state and {desc}: {cmd} ####\n"
+        out += cluster_shell_inst.get_stdout_or_raise_error(cmd)
+        out += "\n\n"
+
+    target_f = os.path.join(workdir, constants.CRM_MON_F)
+    crmutils.str2file(out, target_f)
+    logger.debug(f"Dump crm_mon state into {utils.real_path(target_f)}")
+
+    # Dump other runtime state files
     for cmd, f, desc in [
-        ("crm_mon -1", constants.CRM_MON_F, "cluster state"),
         ("cibadmin -Ql", constants.CIB_F, "CIB contents"),
         ("crm_node -p", constants.MEMBERSHIP_F, "members of this partition")
     ]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/report/sh.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/report/sh.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/report/sh.py        2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/report/sh.py        2024-03-13 
14:56:37.000000000 +0100
@@ -69,6 +69,7 @@
         return subprocess.run(
             args,
             input=cmd.encode('utf-8'),
+            env=os.environ,  # bsc#1205925
             **kwargs,
         )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/scripts.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/scripts.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/scripts.py  2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/scripts.py  2024-03-13 
14:56:37.000000000 +0100
@@ -1068,7 +1068,9 @@
         print((".EXT", cmd))
     cmd = subprocess.Popen(cmd,
                            stdout=subprocess.PIPE,
-                           stderr=subprocess.PIPE)
+                           stderr=subprocess.PIPE,
+                           env=os.environ,  # bsc#1205925
+                           )
     (out, err) = cmd.communicate()
     return "Bad configuration option" not in err
 
@@ -1138,7 +1140,11 @@
     if workdir and os.path.isdir(workdir):
         cleanscript = os.path.join(workdir, 'crm_clean.py')
         if os.path.isfile(cleanscript):
-            if subprocess.call([cleanscript, workdir], shell=False) != 0:
+            if subprocess.call(
+                    [cleanscript, workdir],
+                    shell=False,
+                    env=os.environ,  # bsc#1205925
+            ) != 0:
                 shutil.rmtree(workdir)
         else:
             shutil.rmtree(workdir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/sh.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/sh.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/sh.py       2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/sh.py       2024-03-13 
14:56:37.000000000 +0100
@@ -15,7 +15,7 @@
    configurations.
 4. ShellUtils runs command on local host as current user. It is a simple 
wrapper around subprocess module.
 
-The LocalShell and SshShell is expected to be used in ssh bootstrap. Once the 
ssh bootstrap finishes, AuthShell should
+The LocalShell and SSHShell is expected to be used in ssh bootstrap. Once the 
ssh bootstrap finishes, ClusterShell should
 be used.
 """
 import logging
@@ -150,12 +150,12 @@
             )
         if not self.additional_environ:
             logger.debug('su_subprocess_run: %s, %s', args, kwargs)
-            return subprocess.run(args, **kwargs)
+            env = os.environ    # bsc#1205925
         else:
             logger.debug('su_subprocess_run: %s, env=%s, %s', args, 
self.additional_environ, kwargs)
             env = dict(os.environ)
             env.update(self.additional_environ)
-            return subprocess.run(args, env=env, **kwargs)
+        return subprocess.run(args, env=env, **kwargs)
 
     def get_rc_stdout_stderr_raw(self, user: typing.Optional[str], cmd: str, 
input: typing.Optional[bytes] = None):
         result = self.su_subprocess_run(
@@ -268,6 +268,7 @@
             return subprocess.run(
                 args,
                 input=cmd.encode('utf-8'),
+                env=os.environ,     # bsc#1205925
                 **kwargs,
             )
         else:
@@ -317,6 +318,7 @@
                 return subprocess.run(
                     ['/bin/sh'],
                     input=cmd.encode('utf-8'),
+                    env=os.environ,  # bsc#1205925
                     **kwargs,
                 )
             else:
@@ -436,6 +438,7 @@
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.DEVNULL if stderr_on else subprocess.PIPE,
+            env=os.environ,  # bsc#1205925
         )
         stdout_data, _ = proc.communicate(input_s)
         if raw:
@@ -457,7 +460,9 @@
             shell=shell,
             stdin=input_s and subprocess.PIPE or None,
             stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE)
+            stderr=subprocess.PIPE,
+            env=os.environ,  # bsc#1205925
+        )
         # will raise subprocess.TimeoutExpired if set timeout
         stdout_data, stderr_data = proc.communicate(input_s, timeout=timeout)
         if raw:
@@ -489,3 +494,4 @@
 
 def cluster_shell():
     return ClusterShell(LocalShell(), user_of_host.instance(), 
raise_ssh_error=True)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/term.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/term.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/term.py     2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/term.py     2024-03-13 
14:56:37.000000000 +0100
@@ -1,6 +1,6 @@
 # Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhameda...@suse.de>
 # See COPYING for license information.
-
+import os
 import sys
 import re
 # from: http://code.activestate.com/recipes/475116/
@@ -151,6 +151,7 @@
     from . import config
     if not _term_stream.isatty() and 'color-always' not in config.color.style:
         return
+    _ignore_environ()
     # Check the terminal type.  If we fail, then assume that the
     # terminal has no capabilities.
     try:
@@ -177,4 +178,12 @@
     return hasattr(colors, s.upper())
 
 
+def _ignore_environ():
+    """Ignore environment variable COLUMNS and ROWS"""
+    # See https://bugzilla.suse.com/show_bug.cgi?id=1205925
+    # and 
https://gitlab.com/procps-ng/procps/-/blob/c415fc86452c933716053a50ab1777a343190dcc/src/ps/global.c#L279
+    for name in ["COLUMNS", "ROWS"]:
+        if name in os.environ:
+            del os.environ[name]
+
 # vim:ts=4:sw=4:et:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/ui_node.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/ui_node.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/ui_node.py  2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/ui_node.py  2024-03-13 
14:56:37.000000000 +0100
@@ -1,7 +1,7 @@
 # Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhameda...@suse.de>
 # Copyright (C) 2013 Kristoffer Gronlund <kgronl...@suse.com>
 # See COPYING for license information.
-
+import os
 import re
 import copy
 import subprocess
@@ -550,10 +550,13 @@
         'usage: delete <node>'
         logger.warning('`crm node delete` is deprecated and will very likely 
be dropped in the near future. It is auto-replaced as `crm cluster remove -c 
{}`.'.format(node))
         if config.core.force:
-            rc = subprocess.call(['crm', 'cluster', 'remove', '-F', '-c', 
node])
+            args = ['crm', 'cluster', 'remove', '-F', '-c', node]
         else:
-            rc = subprocess.call(['crm', 'cluster', 'remove', '-c', node])
-        return rc == 0
+            args = ['crm', 'cluster', 'remove', '-c', node]
+        return 0 == subprocess.call(
+            args,
+            env=os.environ,  # bsc#1205925
+        )
 
     @command.wait
     @command.completers(compl.nodes, compl.choice(['set', 'delete', 'show']), 
_find_attr)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/user_of_host.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/user_of_host.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/user_of_host.py     2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/user_of_host.py     2024-03-13 
14:56:37.000000000 +0100
@@ -1,4 +1,5 @@
 import logging
+import os
 import socket
 import subprocess
 import typing
@@ -107,6 +108,7 @@
             stdin=subprocess.DEVNULL,
             stdout=subprocess.DEVNULL,
             stderr=subprocess.DEVNULL,
+            env=os.environ,  # bsc#1205925
         )
         if rc == 0:
             user = userdir.getuser()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/utils.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/utils.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/utils.py    2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/utils.py    2024-03-13 
14:56:37.000000000 +0100
@@ -150,13 +150,14 @@
 
 
 def set_cib_in_use(name):
-    os.putenv(_cib_shadow, name)
+    os.environ[_cib_shadow] = name
     global _cib_in_use
     _cib_in_use = name
 
 
 def clear_cib_in_use():
-    os.unsetenv(_cib_shadow)
+    if _cib_shadow in os.environ:
+        del os.environ[_cib_shadow]
     global _cib_in_use
     _cib_in_use = ''
 
@@ -523,7 +524,12 @@
     logger.debug("piping string to %s", cmd)
     if options.regression_tests:
         print(".EXT", cmd)
-    p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
+    p = subprocess.Popen(
+        cmd,
+        shell=True,
+        stdin=subprocess.PIPE,
+        env=os.environ,  # bsc#1205925
+    )
     try:
         # communicate() expects encoded bytes
         if isinstance(s, str):
@@ -552,7 +558,9 @@
                          shell=shell,
                          stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE,
-                         stderr=stderr)
+                         stderr=stderr,
+                         env=os.environ,  # bsc#1205925
+                         )
     try:
         # bytes expected here
         if isinstance(s, str):
@@ -770,7 +778,9 @@
     if options.regression_tests:
         print(".EXT", cmd)
     subprocess.Popen(cmd, shell=True, bufsize=0,
-                     stdin=None, stdout=None, stderr=None, close_fds=True)
+                     stdin=None, stdout=None, stderr=None, close_fds=True,
+                     env=os.environ,  # bsc#1205925
+                     )
     logger.info("starting %s to show %s", config.core.dotty, desc)
 
 
@@ -779,13 +789,21 @@
     if options.regression_tests:
         print(".EXT", cmd)
     logger.debug("invoke: %s", cmd)
-    return subprocess.call(cmd, shell=shell)
+    return subprocess.call(
+        cmd,
+        shell=shell,
+        env=os.environ,  # bsc#1205925
+    )
 
 
 def ext_cmd_nosudo(cmd, shell=True):
     if options.regression_tests:
         print(".EXT", cmd)
-    return subprocess.call(cmd, shell=shell)
+    return subprocess.call(
+        cmd,
+        shell=shell,
+        env=os.environ,  # bsc#1205925
+    )
 
 
 def rmdir_r(d):
@@ -918,7 +936,9 @@
     proc = subprocess.Popen(cmd,
                             shell=True,
                             stdout=subprocess.PIPE,
-                            stderr=subprocess.PIPE)
+                            stderr=subprocess.PIPE,
+                            env=os.environ,  # bsc#1205925
+                            )
     (outp, err_outp) = proc.communicate()
     proc.wait()
     rc = proc.returncode
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/xmlutil.py 
new/crmsh-4.6.0+20240313.8278d949/crmsh/xmlutil.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/crmsh/xmlutil.py  2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/crmsh/xmlutil.py  2024-03-13 
14:56:37.000000000 +0100
@@ -91,7 +91,11 @@
     cmd = add_sudo(cmd)
     if options.regression_tests:
         print(".EXT", cmd)
-    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
+    p = subprocess.Popen(
+        cmd, shell=True,
+        stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+        env=os.environ,  # bsc#1205925
+    )
     try:
         outp, errp = p.communicate()
         p.wait()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.6.0+20240227.21cbb9ee/test/unittests/test_bootstrap.py 
new/crmsh-4.6.0+20240313.8278d949/test/unittests/test_bootstrap.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/test/unittests/test_bootstrap.py  
2024-02-27 15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/test/unittests/test_bootstrap.py  
2024-03-13 14:56:37.000000000 +0100
@@ -604,7 +604,7 @@
         mock_swap.assert_called_once_with("node1", "bob", "alice", "bob", 
"alice", add=True)
         mock_invoke.assert_called_once_with(
             "bob",
-            "ssh {} alice@node1 sudo crm cluster init -i eth1 
ssh_remote".format(constants.SSH_OPTION),
+            "ssh {} alice@node1 sudo crm cluster init 
ssh_remote".format(constants.SSH_OPTION),
         )
         mock_swap_2.assert_called_once()
         args, kwargs = mock_swap_2.call_args
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.6.0+20240227.21cbb9ee/test/unittests/test_report_collect.py 
new/crmsh-4.6.0+20240313.8278d949/test/unittests/test_report_collect.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/test/unittests/test_report_collect.py     
2024-02-27 15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/test/unittests/test_report_collect.py     
2024-03-13 14:56:37.000000000 +0100
@@ -548,12 +548,19 @@
         ]
         mock_run_inst = mock.Mock()
         mock_run.return_value = mock_run_inst
-        mock_run_inst.get_stdout_or_raise_error.side_effect = ["crm_mon_data", 
"cib_data", "crm_node_data"]
+        mock_run_inst.get_stdout_or_raise_error.side_effect = [
+                "crm_mon_data_r1",
+                "crm_mon_data_n1",
+                "crm_mon_data_rf1",
+                "crm_mon_data_rnt1",
+                "cib_data",
+                "crm_node_data"
+                ]
         mock_get_dc.return_value = "node1"
         mock_this_node.return_value = "node1"
         collect.dump_runtime_state("/opt/workdir")
         mock_debug.assert_has_calls([
-            mock.call(f"Dump cluster state into {constants.CRM_MON_F}"),
+            mock.call(f"Dump crm_mon state into {constants.CRM_MON_F}"),
             mock.call(f"Dump CIB contents into {constants.CIB_F}"),
             mock.call(f"Dump members of this partition into 
{constants.MEMBERSHIP_F}"),
             mock.call(f"Current DC is node1; Touch file 'DC' in workdir")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.6.0+20240227.21cbb9ee/test/unittests/test_sh.py 
new/crmsh-4.6.0+20240313.8278d949/test/unittests/test_sh.py
--- old/crmsh-4.6.0+20240227.21cbb9ee/test/unittests/test_sh.py 2024-02-27 
15:46:22.000000000 +0100
+++ new/crmsh-4.6.0+20240313.8278d949/test/unittests/test_sh.py 2024-03-13 
14:56:37.000000000 +0100
@@ -13,8 +13,9 @@
         self.local_shell.geteuid = mock.Mock(self.local_shell.geteuid)
         self.local_shell.hostname = mock.Mock(self.local_shell.hostname)
 
+    @mock.patch('os.environ')
     @mock.patch('subprocess.run')
-    def test_su_subprocess_run(self, mock_run: mock.MagicMock):
+    def test_su_subprocess_run(self, mock_run: mock.MagicMock, mock_environ: 
mock.MagicMock):
         self.local_shell.get_effective_user_name.return_value = 'root'
         self.local_shell.geteuid.return_value = 0
         self.local_shell.su_subprocess_run(
@@ -24,10 +25,12 @@
         mock_run.assert_called_once_with(
             ['su', 'alice', '--login', '-s', '/bin/sh', '-c', 'foo'],
             input=b'bar',
+            env=mock_environ,
         )
 
+    @mock.patch('os.environ')
     @mock.patch('subprocess.run')
-    def test_su_subprocess_run_as_root(self, mock_run: mock.MagicMock):
+    def test_su_subprocess_run_as_root(self, mock_run: mock.MagicMock, 
mock_environ: mock.MagicMock):
         self.local_shell.get_effective_user_name.return_value = 'root'
         self.local_shell.geteuid.return_value = 0
         self.local_shell.su_subprocess_run(
@@ -37,6 +40,7 @@
         mock_run.assert_called_once_with(
             ['/bin/sh', '-c', 'foo'],
             input=b'bar',
+            env=mock_environ,
         )
 
     @mock.patch('subprocess.run')
@@ -124,8 +128,9 @@
             )
         self.ssh_shell.local_shell.su_subprocess_run.assert_not_called()
 
+    @mock.patch('os.environ')
     @mock.patch('subprocess.run')
-    def test_subprocess_run_without_input_local(self, mock_run):
+    def test_subprocess_run_without_input_local(self, mock_run, mock_environ: 
mock.MagicMock):
         self.ssh_shell.subprocess_run_without_input(
             'node1', 'bob',
             'foo',
@@ -138,6 +143,7 @@
             input=b'foo',
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE,
+            env=mock_environ,
         )
 
 

Reply via email to