Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2018-02-27 16:59:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh" Tue Feb 27 16:59:58 2018 rev:142 rq:580540 version:4.0.0+git.1519721966.9abd841c Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2018-02-14 10:50:55.295196305 +0100 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2018-02-27 17:00:16.599015133 +0100 @@ -1,0 +2,6 @@ +Tue Feb 27 09:55:07 UTC 2018 - [email protected] + +- Update to version 4.0.0+git.1519721966.9abd841c: + * low: bootstrap: Updated authkey generation (bsc#1077389) + +------------------------------------------------------------------- @@ -5 +11 @@ - * fix: bootstrap: Create pacemaker_remote authkey(#bsc 1077389) + * fix: bootstrap: Create pacemaker_remote authkey (bsc#1077389) Old: ---- crmsh-4.0.0+git.1518510059.7a6f94e6.tar.bz2 New: ---- crmsh-4.0.0+git.1519721966.9abd841c.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.wtjnDW/_old 2018-02-27 17:00:17.870969175 +0100 +++ /var/tmp/diff_new_pack.wtjnDW/_new 2018-02-27 17:00:17.882968741 +0100 @@ -34,9 +34,9 @@ Name: crmsh Summary: High Availability cluster command-line interface -License: GPL-2.0+ +License: GPL-2.0-or-later Group: %{pkg_group} -Version: 4.0.0+git.1518510059.7a6f94e6 +Version: 4.0.0+git.1519721966.9abd841c Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.wtjnDW/_old 2018-02-27 17:00:17.962965852 +0100 +++ /var/tmp/diff_new_pack.wtjnDW/_new 2018-02-27 17:00:17.966965706 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">7a6f94e6613a604a540956ff56324a788976b7db</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">9abd841ca08a609923c8406584a112900bb27262</param></service></servicedata> \ No newline at end of file ++++++ crmsh-4.0.0+git.1518510059.7a6f94e6.tar.bz2 -> crmsh-4.0.0+git.1519721966.9abd841c.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.0.0+git.1518510059.7a6f94e6/crmsh/bootstrap.py new/crmsh-4.0.0+git.1519721966.9abd841c/crmsh/bootstrap.py --- old/crmsh-4.0.0+git.1518510059.7a6f94e6/crmsh/bootstrap.py 2018-02-13 09:20:59.000000000 +0100 +++ new/crmsh-4.0.0+git.1519721966.9abd841c/crmsh/bootstrap.py 2018-02-27 09:59:26.000000000 +0100 @@ -623,6 +623,32 @@ tf.write(ff.read()) +def rmfile(path, ignore_errors=False): + """ + Try to remove the given file, and + report an error on failure + """ + try: + os.remove(path) + except os.error as err: + if not ignore_errors: + error("Failed to remove {}: {}".format(path, err)) + + +def mkdirs_owned(dirs, mode=0o777, uid=-1, gid=-1): + """ + Create directory path, setting the mode and + ownership of the leaf directory to mode/uid/gid. + """ + if not os.path.exists(dirs): + try: + os.makedirs(dirs, mode) + except OSError as err: + error("Failed to create {}: {}".format(dirs, err)) + if uid != -1 or gid != -1: + utils.chown(dirs, uid, gid) + + def init_ssh(): """ Configure passwordless SSH. @@ -632,10 +658,7 @@ if os.path.exists("/root/.ssh/id_rsa"): if not confirm("/root/.ssh/id_rsa already exists - overwrite?"): return - try: - os.remove("/root/.ssh/id_rsa") - except os.error: - error("Failed to remove /root/.ssh/id_rsa") + rmfile("/root/.ssh/id_rsa") status("Generating SSH key") invoke("ssh-keygen -q -f /root/.ssh/id_rsa -C 'Cluster Internal' -N ''") append("/root/.ssh/id_rsa.pub", "/root/.ssh/authorized_keys") @@ -741,10 +764,7 @@ if os.path.exists(COROSYNC_AUTH): if not confirm("%s already exists - overwrite?" % (COROSYNC_AUTH)): return - try: - os.remove(COROSYNC_AUTH) - except os.error: - error("Failed to remove %s" % (COROSYNC_AUTH)) + rmfile(COROSYNC_AUTH) invoke("corosync-keygen -l") @@ -755,17 +775,14 @@ if os.path.exists(PCMK_REMOTE_AUTH): if not confirm("%s already exists - overwrite?" % (PCMK_REMOTE_AUTH)): return - try: - os.remove(PCMK_REMOTE_AUTH) - except os.error: - error("Failed to remove %s" % (PCMK_REMOTE_AUTH)) + rmfile(PCMK_REMOTE_AUTH) pcmk_remote_dir = os.path.dirname(PCMK_REMOTE_AUTH) - if not os.path.exists(pcmk_remote_dir): - invoke("mkdir -p --mode=0750 {}".format(pcmk_remote_dir)) - invoke("chgrp haclient {}".format(pcmk_remote_dir)) - - invoke("dd if=/dev/urandom of={} bs=4096 count=1".format(PCMK_REMOTE_AUTH)) + mkdirs_owned(pcmk_remote_dir, mode=0o750, gid="haclient") + if not invoke("dd if=/dev/urandom of={} bs=4096 count=1".format(PCMK_REMOTE_AUTH)): + warn("Failed to create pacemaker authkey: {}".format(PCMK_REMOTE_AUTH)) + utils.chown(PCMK_REMOTE_AUTH, "hacluster", "haclient") + os.chmod(PCMK_REMOTE_AUTH, 0o640) def valid_network(addr, prev_value=None): @@ -1539,7 +1556,7 @@ status_long("Configuring csync2") # Necessary if re-running join on a node that's been configured before. - invoke("rm -f /var/lib/csync2/{}.db3".format(utils.this_node())) + rmfile("/var/lib/csync2/{}.db3".format(utils.this_node()), ignore_errors=True) # Not automatically updating /etc/hosts - risky in the general case. # etc_hosts_add_me @@ -2170,11 +2187,10 @@ def join_remote_auth(node): - invoke("rm -f {}".format(PCMK_REMOTE_AUTH)) + if os.path.exists(PCMK_REMOTE_AUTH): + rmfile(PCMK_REMOTE_AUTH) pcmk_remote_dir = os.path.dirname(PCMK_REMOTE_AUTH) - if not os.path.exists(pcmk_remote_dir): - invoke("mkdir -p --mode=0750 {}".format(pcmk_remote_dir)) - invoke("chgrp haclient {}".format(pcmk_remote_dir)) + mkdirs_owned(pcmk_remote_dir, mode=0o750, gid="haclient") invoke("touch {}".format(PCMK_REMOTE_AUTH)) @@ -2225,8 +2241,15 @@ # remove all trace of cluster from this node # delete configuration files from the node to be removed - toremove = [SYSCONFIG_SBD, CSYNC2_CFG, corosync.conf(), CSYNC2_KEY, COROSYNC_AUTH] - if not invoke('bash -c "rm -f {} && rm -f /var/lib/heartbeat/crm/* /var/lib/pacemaker/cib/*"'.format(" ".join(toremove))): + toremove = [ + SYSCONFIG_SBD, + CSYNC2_CFG, + corosync.conf(), + CSYNC2_KEY, + COROSYNC_AUTH, + "/var/lib/heartbeat/crm/*", + "/var/lib/pacemaker/cib/*"] + if not invoke('bash -c "rm -f {}"'.format(" ".join(toremove))): error("Deleting the configuration files failed") else: remove_node_from_cluster() @@ -2256,7 +2279,7 @@ def create_booth_authkey(): status("Create authentication key for booth") if os.path.exists(BOOTH_AUTH): - invoke("rm -f {}".format(BOOTH_AUTH)) + rmfile(BOOTH_AUTH) if not invoke("booth-keygen {}".format(BOOTH_AUTH)): error("Failed to generate booth authkey") @@ -2284,7 +2307,7 @@ cfg = "\n".join(cfg) + "\n" if os.path.exists(BOOTH_CFG): - invoke("rm -f {}".format(BOOTH_CFG)) + rmfile(BOOTH_CFG) utils.str2file(cfg, BOOTH_CFG) utils.chown(BOOTH_CFG, "hacluster", "haclient") os.chmod(BOOTH_CFG, 0o644)
