Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2020-04-13 12:53:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh" Mon Apr 13 12:53:38 2020 rev:183 rq:793561 version:4.2.0+git.1586769845.5cf0290e Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2020-04-02 17:45:17.457524679 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new.3248/crmsh.changes 2020-04-13 12:53:40.124658105 +0200 @@ -1,0 +2,19 @@ +Mon Apr 13 09:34:31 UTC 2020 - [email protected] + +- Update to version 4.2.0+git.1586769845.5cf0290e: + * Low: ui_corosync: print cluster nodes while getting quorum and qnetd status + +------------------------------------------------------------------- +Thu Apr 09 10:29:47 UTC 2020 - [email protected] + +- Update to version 4.2.0+git.1586427566.1acaafaf: + * Low: bootstrap: exit with proper error messages when ssh return failed + +------------------------------------------------------------------- +Tue Apr 07 15:13:52 UTC 2020 - [email protected] + +- Update to version 4.2.0+git.1586271789.976af135: + * Dev: unittest: test interface_choice function + * Low: ui_cluster: use argparse choices to validate -i and -t option + +------------------------------------------------------------------- Old: ---- crmsh-4.2.0+git.1585823626.1dd5ce1f.tar.bz2 New: ---- crmsh-4.2.0+git.1586769845.5cf0290e.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.MAiMm6/_old 2020-04-13 12:53:41.004658489 +0200 +++ /var/tmp/diff_new_pack.MAiMm6/_new 2020-04-13 12:53:41.004658489 +0200 @@ -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.1585823626.1dd5ce1f +Version: 4.2.0+git.1586769845.5cf0290e Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.MAiMm6/_old 2020-04-13 12:53:41.040658505 +0200 +++ /var/tmp/diff_new_pack.MAiMm6/_new 2020-04-13 12:53:41.040658505 +0200 @@ -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">d696fa20dd2f583a4b465a9ad40da708f70d0eee</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">5cf0290e56f929f03969d687863885f7975e6926</param></service></servicedata> \ No newline at end of file ++++++ crmsh-4.2.0+git.1585823626.1dd5ce1f.tar.bz2 -> crmsh-4.2.0+git.1586769845.5cf0290e.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/bootstrap.py new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/bootstrap.py --- old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/bootstrap.py 2020-04-02 12:33:46.000000000 +0200 +++ new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/bootstrap.py 2020-04-13 11:24:05.000000000 +0200 @@ -1622,7 +1622,15 @@ def init_qdevice(): def copy_ssh_id_to_qnetd(): status("Copy ssh key to qnetd node({})".format(qnetd_addr)) - invoke("ssh-copy-id -i /root/.ssh/id_rsa.pub root@{}".format(qnetd_addr)) + if not invoke("ssh-copy-id -i /root/.ssh/id_rsa.pub root@{}".format(qnetd_addr)): + error_msg = "Failed to copy ssh key" + if not _context.stage: + suggest = """ +Cluster service already successfully started on this node. +If you still want to use qdevice, run previous init command with \"qdevice\" stage. +That will setup qdevice separately""" + error_msg += suggest + error(error_msg) def qdevice_cert_process(): _context.qdevice.init_db_on_qnetd() @@ -1705,7 +1713,8 @@ tmpdir = tmpfiles.create_dir() status("Retrieving SSH keys - This may prompt for root@%s:" % (seed_host)) - invoke("scp -oStrictHostKeyChecking=no root@%s:'/root/.ssh/id_*' %s/" % (seed_host, tmpdir)) + if not invoke("scp -oStrictHostKeyChecking=no root@%s:'/root/.ssh/id_*' %s/" % (seed_host, tmpdir)): + error("Failed to retrieve ssh keys") # This supports all SSH key types, for the case where ha-cluster-init # wasn't used to set up the seed node, and the user has manually @@ -2539,7 +2548,8 @@ # TODO: clean this up status("Retrieving configuration - This may prompt for root@%s:" % (node)) tmpdir = tmpfiles.create_dir() - invoke("scp -oStrictHostKeyChecking=no root@%s:'/etc/booth/*' %s/" % (node, tmpdir)) + if not invoke("scp -oStrictHostKeyChecking=no root@%s:'/etc/booth/*' %s/" % (node, tmpdir)): + error("Failed to retrieve configuration") try: if os.path.isfile("%s/authkey" % (tmpdir)): invoke("mv %s/authkey %s" % (tmpdir, BOOTH_AUTH)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/ui_cluster.py new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/ui_cluster.py --- old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/ui_cluster.py 2020-04-02 12:33:46.000000000 +0200 +++ new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/ui_cluster.py 2020-04-13 11:24:05.000000000 +0200 @@ -206,7 +206,7 @@ help="Be quiet (don't describe what's happening, just do it)") parser.add_argument("-y", "--yes", action="store_true", dest="yes_to_all", help='Answer "yes" to all prompts (use with caution, this is destructive, especially during the "storage" stage. The /root/.ssh/id_rsa key will be overwritten unless the option "--no-overwrite-sshkey" is used)') - parser.add_argument("-t", "--template", dest="template", + parser.add_argument("-t", "--template", dest="template", metavar="TEMPLATE", choices=['ocfs2'], help='Optionally configure cluster with template "name" (currently only "ocfs2" is valid here)') parser.add_argument("-n", "--name", metavar="NAME", dest="cluster_name", default="hacluster", help='Set the name of the configured cluster.') @@ -221,7 +221,7 @@ help='Avoid "/root/.ssh/id_rsa" overwrite if "-y" option is used (False by default)') network_group = parser.add_argument_group("Network configuration", "Options for configuring the network and messaging layer.") - network_group.add_argument("-i", "--interface", dest="nic", metavar="IF", + network_group.add_argument("-i", "--interface", dest="nic", metavar="IF", choices=utils.interface_choice(), help="Bind to IP address on interface IF") network_group.add_argument("-u", "--unicast", action="store_true", dest="unicast", help="Configure corosync to communicate over unicast (UDP), and not multicast. " + @@ -267,9 +267,6 @@ if stage not in bootstrap.INIT_STAGES and stage != "": parser.error("Invalid stage (%s)" % (stage)) - if options.template and options.template != "ocfs2": - parser.error("Invalid template (%s)" % (options.template)) - if options.qdevice_host: if options.qdevice_heuristics_mode and not options.qdevice_heuristics: parser.error("Option --qdevice-heuristics is required if want to configure heuristics mode") @@ -323,7 +320,8 @@ network_group = parser.add_argument_group("Network configuration", "Options for configuring the network and messaging layer.") network_group.add_argument("-c", "--cluster-node", dest="cluster_node", help="IP address or hostname of existing cluster node", metavar="HOST") - network_group.add_argument("-i", "--interface", dest="nic", help="Bind to IP address on interface IF", metavar="IF") + network_group.add_argument("-i", "--interface", dest="nic", metavar="IF", choices=utils.interface_choice(), + help="Bind to IP address on interface IF") options, args = parse_options(parser, args) if options is None or args is None: return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/ui_corosync.py new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/ui_corosync.py --- old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/ui_corosync.py 2020-04-02 12:33:46.000000000 +0200 +++ new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/ui_corosync.py 2020-04-13 11:24:05.000000000 +0200 @@ -62,6 +62,11 @@ ''' Quick cluster health status. Corosync status or QNetd status ''' + def print_cluster_nodes(): + rc, out = utils.get_stdout("crm_node -l") + if rc == 0 and out: + print("{}\n".format(out)) + rc, _ = utils.get_stdout('systemctl -q is-active corosync.service') if rc != 0: err_buf.error("corosync.service is not running!") @@ -71,6 +76,7 @@ print(corosync.cfgtool('-s')[1]) return if status_type == "quorum": + print_cluster_nodes() print(corosync.quorumtool('-s')[1]) return if status_type == "qnetd": @@ -94,6 +100,7 @@ return False _, qnetd_result_stdout, _ = result[0][1] if qnetd_result_stdout: + print_cluster_nodes() print(utils.to_ascii(qnetd_result_stdout)) return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/utils.py new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/utils.py --- old/crmsh-4.2.0+git.1585823626.1dd5ce1f/crmsh/utils.py 2020-04-02 12:33:46.000000000 +0200 +++ new/crmsh-4.2.0+git.1586769845.5cf0290e/crmsh/utils.py 2020-04-13 11:24:05.000000000 +0200 @@ -2280,4 +2280,11 @@ value = getattr(options, opt) if isinstance(value, str) and len(value.strip()) == 0: raise ValueError("Space value not allowed for dest \"{}\"".format(opt)) + + +def interface_choice(): + _, out = get_stdout("ip a") + # should consider interface format like "ethx@xxx" + interface_list = re.findall(r'(?:[0-9]+:) (.*?)(?=: |@.*?: )', out) + return [nic for nic in interface_list if nic != "lo"] # vim:ts=4:sw=4:et: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1585823626.1dd5ce1f/test/unittests/test_report.py new/crmsh-4.2.0+git.1586769845.5cf0290e/test/unittests/test_report.py --- old/crmsh-4.2.0+git.1585823626.1dd5ce1f/test/unittests/test_report.py 2020-04-02 12:33:46.000000000 +0200 +++ new/crmsh-4.2.0+git.1586769845.5cf0290e/test/unittests/test_report.py 2020-04-13 11:24:05.000000000 +0200 @@ -278,7 +278,7 @@ def test_is_our_log(): # empty log temp_file = create_tempfile() - assert is_our_log(temp_file, time_before, time_between) == 2 + assert is_our_log(temp_file, time_before, time_between) == 0 # from_time > last_time assert is_our_log(pacemaker_log, time_after, time_between) == 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1585823626.1dd5ce1f/test/unittests/test_utils.py new/crmsh-4.2.0+git.1586769845.5cf0290e/test/unittests/test_utils.py --- old/crmsh-4.2.0+git.1585823626.1dd5ce1f/test/unittests/test_utils.py 2020-04-02 12:33:46.000000000 +0200 +++ new/crmsh-4.2.0+git.1586769845.5cf0290e/test/unittests/test_utils.py 2020-04-13 11:24:05.000000000 +0200 @@ -571,3 +571,35 @@ ]) assert mock_metadata.call_count == 0 assert utils._ip_for_cloud is None + + [email protected]("crmsh.utils.get_stdout") +def test_interface_choice(mock_get_stdout): + ip_a_output = """ +1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever +2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + link/ether 52:54:00:9e:1b:4f brd ff:ff:ff:ff:ff:ff + inet 192.168.122.241/24 brd 192.168.122.255 scope global enp1s0 + valid_lft forever preferred_lft forever + inet6 fe80::5054:ff:fe9e:1b4f/64 scope link + valid_lft forever preferred_lft forever +3: br-933fa0e1438c: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default + link/ether 9e:fe:24:df:59:49 brd ff:ff:ff:ff:ff:ff + inet 10.10.10.1/24 brd 10.10.10.255 scope global br-933fa0e1438c + valid_lft forever preferred_lft forever + inet6 fe80::9cfe:24ff:fedf:5949/64 scope link + valid_lft forever preferred_lft forever +4: veth3fff6e9@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default + link/ether 1e:2c:b3:73:6b:42 brd ff:ff:ff:ff:ff:ff link-netnsid 0 + inet6 fe80::1c2c:b3ff:fe73:6b42/64 scope link + valid_lft forever preferred_lft forever + valid_lft forever preferred_lft forever +""" + mock_get_stdout.return_value = (0, ip_a_output) + assert utils.interface_choice() == ["enp1s0", "br-933fa0e1438c", "veth3fff6e9"] + mock_get_stdout.assert_called_once_with("ip a")
