Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2020-12-03 18:42:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crmsh (Old)
 and      /work/SRC/openSUSE:Factory/.crmsh.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crmsh"

Thu Dec  3 18:42:59 2020 rev:197 rq:852791 version:4.2.0+git.1606837217.bf7af3a6

Changes:
--------
--- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes      2020-11-02 
09:42:24.653726080 +0100
+++ /work/SRC/openSUSE:Factory/.crmsh.new.5913/crmsh.changes    2020-12-03 
18:43:54.326250951 +0100
@@ -1,0 +2,33 @@
+Tue Dec 01 15:51:44 UTC 2020 - [email protected]
+
+- Update to version 4.2.0+git.1606837217.bf7af3a6:
+  * Dev: unittest: adjust ut for disable_service and enable_service changes
+  * Fix: utils: improve disable_service and enable_service 
function(bsc#1178701)
+
+-------------------------------------------------------------------
+Mon Nov 16 07:42:07 UTC 2020 - [email protected]
+
+- Update to version 4.2.0+git.1605511823.7cff5ff0:
+  * Dev: unittest: adjust unit test for disable corosync-qdevice
+  * Fix: bootstrap: disable corosync-qdevice if not configured(bsc#1178701)
+
+-------------------------------------------------------------------
+Thu Nov 12 08:02:08 UTC 2020 - [email protected]
+
+- Update to version 4.2.0+git.1605167067.631c7f2c:
+  * Dev: hb_report: change the default dest data format, more readable
+
+-------------------------------------------------------------------
+Tue Nov 10 02:34:50 UTC 2020 - [email protected]
+
+- Update to version 4.2.0+git.1604973283.791bdb4c:
+  * Dev: unittest: add unit test for _get_sbd_device_interactive function
+  * Low: bootstrap: minor change for _get_sbd_device_interactive 
function(bsc#1178333)
+
+-------------------------------------------------------------------
+Mon Nov 09 07:17:24 UTC 2020 - [email protected]
+
+- Update to version 4.2.0+git.1604900699.29415625:
+  * Low: bootstrap: should include /etc/sysconfig/nfs into 
csync2.cfg(bsc#1178373)
+
+-------------------------------------------------------------------

Old:
----
  crmsh-4.2.0+git.1604052559.2a348644.tar.bz2

New:
----
  crmsh-4.2.0+git.1606837217.bf7af3a6.tar.bz2

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

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.xz0mak/_old  2020-12-03 18:43:55.146252034 +0100
+++ /var/tmp/diff_new_pack.xz0mak/_new  2020-12-03 18:43:55.150252039 +0100
@@ -36,7 +36,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0-or-later
 Group:          %{pkg_group}
-Version:        4.2.0+git.1604052559.2a348644
+Version:        4.2.0+git.1606837217.bf7af3a6
 Release:        0
 Url:            http://crmsh.github.io
 Source0:        %{name}-%{version}.tar.bz2

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.xz0mak/_old  2020-12-03 18:43:55.194252097 +0100
+++ /var/tmp/diff_new_pack.xz0mak/_new  2020-12-03 18:43:55.194252097 +0100
@@ -5,4 +5,4 @@
                 <param 
name="url">https://github.com/liangxin1300/crmsh.git</param>
               <param 
name="changesrevision">d8dc51b4cb34964aa72e918999ebc7f03b48f3c9</param></service><service
 name="tar_scm">
                 <param 
name="url">https://github.com/ClusterLabs/crmsh.git</param>
-              <param 
name="changesrevision">d94b31b1cb3775b03e2120e8fcf43d9b10019f0b</param></service></servicedata>
\ No newline at end of file
+              <param 
name="changesrevision">715b9035cf2bc766d3809a8fe85bbeccf63a93b9</param></service></servicedata>
\ No newline at end of file

++++++ crmsh-4.2.0+git.1604052559.2a348644.tar.bz2 -> 
crmsh-4.2.0+git.1606837217.bf7af3a6.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1604052559.2a348644/crmsh/bootstrap.py 
new/crmsh-4.2.0+git.1606837217.bf7af3a6/crmsh/bootstrap.py
--- old/crmsh-4.2.0+git.1604052559.2a348644/crmsh/bootstrap.py  2020-10-30 
11:09:19.000000000 +0100
+++ new/crmsh-4.2.0+git.1606837217.bf7af3a6/crmsh/bootstrap.py  2020-12-01 
16:40:17.000000000 +0100
@@ -215,7 +215,7 @@
         Get sbd device on interactive mode
         """
         if _context.yes_to_all:
-            warn("Not configuring SBD (%s left untouched)." % (SYSCONFIG_SBD))
+            warn("Not configuring SBD ({} left 
untouched).".format(SYSCONFIG_SBD))
             return
 
         status(self.SBD_STATUS_DESCRIPTION)
@@ -226,14 +226,16 @@
 
         self._check_environment()
 
-        configured_dev = self._get_sbd_device_from_config()
-        if configured_dev and not confirm("SBD is already configured to use {} 
- overwrite?".format(';'.join(configured_dev))):
-            return configured_dev
+        configured_dev_list = self._get_sbd_device_from_config()
+        if configured_dev_list and not confirm("SBD is already configured to 
use {} - overwrite?".format(';'.join(configured_dev_list))):
+            return configured_dev_list
 
         dev_list = []
         dev_looks_sane = False
         while not dev_looks_sane:
             dev = prompt_for_string('Path to storage device (e.g. 
/dev/disk/by-id/...), or "none" for diskless sbd, use ";" as separator for 
multi path', r'none|\/.*')
+            if not dev:
+                continue
             if dev == "none":
                 self.diskless_sbd = True
                 return
@@ -241,7 +243,7 @@
             try:
                 self._verify_sbd_device(dev_list)
             except ValueError as err_msg:
-                print(term.render(clidisplay.error(str(err_msg))))
+                print_error_msg(str(err_msg))
                 continue
             for dev_item in dev_list:
                 warn("All data on {} will be destroyed!".format(dev_item))
@@ -1019,6 +1021,7 @@
 include /etc/lvm/lvm.conf;
 include /etc/multipath.conf;
 include /etc/samba/smb.conf;
+include /etc/sysconfig/nfs;
 include /etc/sysconfig/pacemaker;
 include /etc/sysconfig/sbd;
 include /etc/pacemaker/authkey;
@@ -1618,6 +1621,7 @@
     """
     # If don't want to config qdevice, return
     if not _context.qdevice_inst:
+        utils.disable_service("corosync-qdevice.service")
         return
 
     status("""
@@ -2112,6 +2116,8 @@
 
     if is_qdevice_configured:
         start_qdevice_on_join_node(seed_host)
+    else:
+        utils.disable_service("corosync-qdevice.service")
 
 
 def start_qdevice_on_join_node(seed_host):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh-4.2.0+git.1604052559.2a348644/crmsh/utils.py 
new/crmsh-4.2.0+git.1606837217.bf7af3a6/crmsh/utils.py
--- old/crmsh-4.2.0+git.1604052559.2a348644/crmsh/utils.py      2020-10-30 
11:09:19.000000000 +0100
+++ new/crmsh-4.2.0+git.1606837217.bf7af3a6/crmsh/utils.py      2020-12-01 
16:40:17.000000000 +0100
@@ -2511,12 +2511,15 @@
             raise ValueError("Run \"{}\" error: {}".format(cmd, err))
         return rc == 0, output
 
+    @property
     def is_available(self):
         return self.service_name in 
self._do_action(self.ACTION_MAP["is_available"])[1]
 
+    @property
     def is_enabled(self):
         return self._do_action(self.ACTION_MAP["is_enabled"])[0]
 
+    @property
     def is_active(self):
         return self._do_action(self.ACTION_MAP["is_active"])[0]
 
@@ -2538,7 +2541,7 @@
         Check whether service is available
         """
         inst = cls(name, remote_addr)
-        return inst.is_available()
+        return inst.is_available
 
     @classmethod
     def service_is_enabled(cls, name, remote_addr=None):
@@ -2546,7 +2549,7 @@
         Check whether service is enabled
         """
         inst = cls(name, remote_addr)
-        return inst.is_enabled()
+        return inst.is_enabled
 
     @classmethod
     def service_is_active(cls, name, remote_addr=None):
@@ -2554,7 +2557,7 @@
         Check whether service is active
         """
         inst = cls(name, remote_addr)
-        return inst.is_active()
+        return inst.is_active
 
     @classmethod
     def start_service(cls, name, enable=False, remote_addr=None):
@@ -2582,7 +2585,8 @@
         Enable service
         """
         inst = cls(name, remote_addr)
-        inst.enable()
+        if inst.is_available and not inst.is_enabled:
+            inst.enable()
 
     @classmethod
     def disable_service(cls, name, remote_addr=None):
@@ -2590,7 +2594,8 @@
         Disable service
         """
         inst = cls(name, remote_addr)
-        inst.disable()
+        if inst.is_available and inst.is_enabled:
+            inst.disable()
 
 
 service_is_available = ServiceManager.service_is_available
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1604052559.2a348644/hb_report/hb_report.in 
new/crmsh-4.2.0+git.1606837217.bf7af3a6/hb_report/hb_report.in
--- old/crmsh-4.2.0+git.1604052559.2a348644/hb_report/hb_report.in      
2020-10-30 11:09:19.000000000 +0100
+++ new/crmsh-4.2.0+git.1606837217.bf7af3a6/hb_report/hb_report.in      
2020-12-01 16:40:17.000000000 +0100
@@ -136,7 +136,7 @@
 
     if len(arg) == 0:
         constants.DESTDIR = "."
-        constants.DEST = "hb_report-%s" % 
datetime.datetime.now().strftime('%w-%d-%m-%Y')
+        constants.DEST = "hb_report-%s" % 
datetime.datetime.now().strftime('%a-%d-%b-%Y')
     elif len(arg) == 1:
         constants.TMP = arg[0]
     else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_bootstrap.py 
new/crmsh-4.2.0+git.1606837217.bf7af3a6/test/unittests/test_bootstrap.py
--- old/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_bootstrap.py    
2020-10-30 11:09:19.000000000 +0100
+++ new/crmsh-4.2.0+git.1606837217.bf7af3a6/test/unittests/test_bootstrap.py    
2020-12-01 16:40:17.000000000 +0100
@@ -53,6 +53,116 @@
         Global tearDown.
         """
 
+    @mock.patch('crmsh.bootstrap.warn')
+    def test_get_sbd_device_interactive_yes_to_all(self, mock_warn):
+        bootstrap._context = mock.Mock(yes_to_all=True)
+        self.sbd_inst._get_sbd_device_interactive()
+        mock_warn.assert_called_once_with("Not configuring SBD ({} left 
untouched).".format(bootstrap.SYSCONFIG_SBD))
+
+    @mock.patch('crmsh.bootstrap.confirm')
+    @mock.patch('crmsh.bootstrap.status')
+    @mock.patch('crmsh.bootstrap.warn')
+    def test__get_sbd_device_interactive_not_confirm(self, mock_warn, 
mock_status, mock_confirm):
+        bootstrap._context = mock.Mock(yes_to_all=False)
+        mock_confirm.return_value = False
+        self.sbd_inst._get_sbd_device_interactive()
+        
mock_status.assert_called_once_with(bootstrap.SBDManager.SBD_STATUS_DESCRIPTION)
+        mock_warn.assert_called_once_with("Not configuring SBD - STONITH will 
be disabled.")
+
+    @mock.patch('crmsh.bootstrap.SBDManager._get_sbd_device_from_config')
+    @mock.patch('crmsh.bootstrap.SBDManager._check_environment')
+    @mock.patch('crmsh.bootstrap.confirm')
+    @mock.patch('crmsh.bootstrap.status')
+    def test__get_sbd_device_interactive_already_configured(self, mock_status, 
mock_confirm, mock_check, mock_from_config):
+        bootstrap._context = mock.Mock(yes_to_all=False)
+        mock_confirm.side_effect = [True, False]
+        mock_from_config.return_value = ["/dev/sda1"]
+
+        res = self.sbd_inst._get_sbd_device_interactive()
+        self.assertEqual(res, ["/dev/sda1"])
+
+        
mock_status.assert_called_once_with(bootstrap.SBDManager.SBD_STATUS_DESCRIPTION)
+        mock_confirm.assert_has_calls([
+            mock.call("Do you wish to use SBD?"),
+            mock.call("SBD is already configured to use /dev/sda1 - 
overwrite?")
+            ])
+        
mock_status.assert_called_once_with(bootstrap.SBDManager.SBD_STATUS_DESCRIPTION)
+        mock_check.assert_called_once_with()
+        mock_from_config.assert_called_once_with()
+
+    @mock.patch('crmsh.bootstrap.prompt_for_string')
+    @mock.patch('crmsh.bootstrap.SBDManager._get_sbd_device_from_config')
+    @mock.patch('crmsh.bootstrap.SBDManager._check_environment')
+    @mock.patch('crmsh.bootstrap.confirm')
+    @mock.patch('crmsh.bootstrap.status')
+    def test_get_sbd_device_interactive_diskless(self, mock_status, 
mock_confirm, mock_check, mock_from_config, mock_prompt):
+        bootstrap._context = mock.Mock(yes_to_all=False)
+        mock_confirm.return_value = True
+        mock_from_config.return_value = None
+        mock_prompt.return_value = "none"
+
+        self.sbd_inst._get_sbd_device_interactive()
+
+        
mock_status.assert_called_once_with(bootstrap.SBDManager.SBD_STATUS_DESCRIPTION)
+        mock_check.assert_called_once_with()
+        mock_from_config.assert_called_once_with()
+        mock_prompt.assert_called_once_with('Path to storage device (e.g. 
/dev/disk/by-id/...), or "none" for diskless sbd, use ";" as separator for 
multi path', 'none|\\/.*')
+
+    @mock.patch('crmsh.bootstrap.prompt_for_string')
+    @mock.patch('crmsh.bootstrap.SBDManager._get_sbd_device_from_config')
+    @mock.patch('crmsh.bootstrap.SBDManager._check_environment')
+    @mock.patch('crmsh.bootstrap.confirm')
+    @mock.patch('crmsh.bootstrap.status')
+    def test_get_sbd_device_interactive_null_and_diskless(self, mock_status, 
mock_confirm, mock_check, mock_from_config, mock_prompt):
+        bootstrap._context = mock.Mock(yes_to_all=False)
+        mock_confirm.return_value = True
+        mock_from_config.return_value = None
+        mock_prompt.side_effect = [None, "none"]
+
+        self.sbd_inst._get_sbd_device_interactive()
+
+        
mock_status.assert_called_once_with(bootstrap.SBDManager.SBD_STATUS_DESCRIPTION)
+        mock_confirm.assert_called_once_with("Do you wish to use SBD?")
+        mock_check.assert_called_once_with()
+        mock_from_config.assert_called_once_with()
+        mock_prompt.assert_has_calls([
+            mock.call('Path to storage device (e.g. /dev/disk/by-id/...), or 
"none" for diskless sbd, use ";" as separator for multi path', 'none|\\/.*') 
for x in range(2)
+            ])
+
+    @mock.patch('crmsh.bootstrap.warn')
+    @mock.patch('crmsh.bootstrap.print_error_msg')
+    @mock.patch('crmsh.bootstrap.SBDManager._verify_sbd_device')
+    @mock.patch('crmsh.bootstrap.prompt_for_string')
+    @mock.patch('crmsh.bootstrap.SBDManager._get_sbd_device_from_config')
+    @mock.patch('crmsh.bootstrap.SBDManager._check_environment')
+    @mock.patch('crmsh.bootstrap.confirm')
+    @mock.patch('crmsh.bootstrap.status')
+    def test_get_sbd_device_interactive(self, mock_status, mock_confirm, 
mock_check, mock_from_config, mock_prompt, mock_verify, mock_error_msg, 
mock_warn):
+        bootstrap._context = mock.Mock(yes_to_all=False)
+        mock_confirm.side_effect = [True, False, True]
+        mock_from_config.return_value = None
+        mock_prompt.side_effect = ["/dev/test1", "/dev/sda1", "/dev/sdb1"]
+        mock_verify.side_effect = [ValueError("/dev/test1 error"), None, None]
+
+        res = self.sbd_inst._get_sbd_device_interactive()
+        self.assertEqual(res, ["/dev/sdb1"])
+
+        
mock_status.assert_called_once_with(bootstrap.SBDManager.SBD_STATUS_DESCRIPTION)
+        mock_confirm.assert_has_calls([
+            mock.call("Do you wish to use SBD?"),
+            mock.call("Are you sure you wish to use this device?")
+            ])
+        mock_check.assert_called_once_with()
+        mock_from_config.assert_called_once_with()
+        mock_error_msg.assert_called_once_with("/dev/test1 error")
+        mock_warn.assert_has_calls([
+            mock.call("All data on /dev/sda1 will be destroyed!"),
+            mock.call("All data on /dev/sdb1 will be destroyed!")
+            ])
+        mock_prompt.assert_has_calls([
+            mock.call('Path to storage device (e.g. /dev/disk/by-id/...), or 
"none" for diskless sbd, use ";" as separator for multi path', 'none|\\/.*') 
for x in range(3)
+            ])
+
     @mock.patch('crmsh.bootstrap.error')
     @mock.patch('crmsh.bootstrap.check_watchdog')
     def test_check_environment_no_watchdog(self, mock_watchdog, mock_error):
@@ -780,11 +890,13 @@
         
mock_interfaces_inst.get_default_nic_list_from_route.assert_called_once_with()
         mock_interfaces_inst.get_default_ip_list.assert_called_once_with()
 
+    @mock.patch('crmsh.utils.disable_service')
     @mock.patch('crmsh.bootstrap.status')
-    def test_init_qdevice_no_config(self, mock_status):
+    def test_init_qdevice_no_config(self, mock_status, mock_disable):
         bootstrap._context = mock.Mock(qdevice_inst=None)
         bootstrap.init_qdevice()
         mock_status.assert_not_called()
+        mock_disable.assert_called_once_with("corosync-qdevice.service")
 
     @mock.patch('crmsh.bootstrap.error')
     @mock.patch('crmsh.bootstrap.invoke')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_utils.py 
new/crmsh-4.2.0+git.1606837217.bf7af3a6/test/unittests/test_utils.py
--- old/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_utils.py        
2020-10-30 11:09:19.000000000 +0100
+++ new/crmsh-4.2.0+git.1606837217.bf7af3a6/test/unittests/test_utils.py        
2020-12-01 16:40:17.000000000 +0100
@@ -1119,19 +1119,19 @@
     def test_is_available(self):
         self.service_local._do_action = mock.Mock()
         self.service_local._do_action.return_value = (True, "service1 
service2")
-        assert self.service_local.is_available() == True
+        assert self.service_local.is_available == True
         
self.service_local._do_action.assert_called_once_with("list-unit-files")
 
     def test_is_enabled(self):
         self.service_local._do_action = mock.Mock()
         self.service_local._do_action.return_value = (True, None)
-        assert self.service_local.is_enabled() == True
+        assert self.service_local.is_enabled == True
         self.service_local._do_action.assert_called_once_with("is-enabled")
 
     def test_is_active(self):
         self.service_local._do_action = mock.Mock()
         self.service_local._do_action.return_value = (True, None)
-        assert self.service_local.is_active() == True
+        assert self.service_local.is_active == True
         self.service_local._do_action.assert_called_once_with("is-active")
 
     def test_start(self):
@@ -1158,21 +1158,21 @@
         self.service_local.disable()
         self.service_local._do_action.assert_called_once_with("disable")
 
-    @mock.patch("crmsh.utils.ServiceManager.is_available")
+    @mock.patch("crmsh.utils.ServiceManager.is_available", 
new_callable=mock.PropertyMock)
     def test_service_is_available(self, mock_available):
         mock_available.return_value = True
         res = utils.ServiceManager.service_is_available("service1")
         self.assertEqual(res, True)
         mock_available.assert_called_once_with()
 
-    @mock.patch("crmsh.utils.ServiceManager.is_enabled")
+    @mock.patch("crmsh.utils.ServiceManager.is_enabled", 
new_callable=mock.PropertyMock)
     def test_service_is_enabled(self, mock_enabled):
         mock_enabled.return_value = True
         res = utils.ServiceManager.service_is_enabled("service1")
         self.assertEqual(res, True)
         mock_enabled.assert_called_once_with()
 
-    @mock.patch("crmsh.utils.ServiceManager.is_active")
+    @mock.patch("crmsh.utils.ServiceManager.is_active", 
new_callable=mock.PropertyMock)
     def test_service_is_active(self, mock_active):
         mock_active.return_value = True
         res = utils.ServiceManager.service_is_active("service1")
@@ -1194,12 +1194,20 @@
         mock_stop.assert_called_once_with()
 
     @mock.patch('crmsh.utils.ServiceManager.enable')
-    def test_enable_service(self, mock_enable):
+    @mock.patch('crmsh.utils.ServiceManager.is_enabled', 
new_callable=mock.PropertyMock)
+    @mock.patch('crmsh.utils.ServiceManager.is_available', 
new_callable=mock.PropertyMock)
+    def test_enable_service(self, mock_available, mock_enabled, mock_enable):
+        mock_available.return_value = True
+        mock_enabled.return_value = False
         utils.ServiceManager.enable_service("service1")
         mock_enable.assert_called_once_with()
 
     @mock.patch('crmsh.utils.ServiceManager.disable')
-    def test_disable_service(self, mock_disable):
+    @mock.patch('crmsh.utils.ServiceManager.is_enabled', 
new_callable=mock.PropertyMock)
+    @mock.patch('crmsh.utils.ServiceManager.is_available', 
new_callable=mock.PropertyMock)
+    def test_disable_service(self, mock_available, mock_enabled, mock_disable):
+        mock_available.return_value = True
+        mock_enabled.return_value = True
         utils.ServiceManager.disable_service("service1")
         mock_disable.assert_called_once_with()
 
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to