Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2016-05-23 16:40:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh" Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2016-05-17 17:15:03.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2016-05-23 16:40:43.000000000 +0200 @@ -1,0 +2,11 @@ +Mon May 23 08:25:56 UTC 2016 - kgronl...@suse.com + +- Update to version 2.2.0+git.1463777827.9b402a8: + + high: history: Store live report in per-user directory (bsc#980924) + + medium: logparser: Handle read-only access to metadata cache (bsc#980924) + + medium: logparser: Fix use-before-declaration error in logparser + + medium: history: Report better error when history user is not sudoer (bsc#980924) + + low: utils: Clearer error if permission denied when locking (bsc#980924) + + low: history: fall back to any log file in report root + +------------------------------------------------------------------- Old: ---- crmsh-2.2.0+git.1462967444.169c554.tar.bz2 New: ---- crmsh-2.2.0+git.1463777827.9b402a8.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.QN4DjC/_old 2016-05-23 16:40:46.000000000 +0200 +++ /var/tmp/diff_new_pack.QN4DjC/_new 2016-05-23 16:40:46.000000000 +0200 @@ -32,13 +32,13 @@ %{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%define version_unconverted 2.2.0+git.1462967444.169c554 +%define version_unconverted 2.2.0+git.1463777827.9b402a8 Name: crmsh Summary: High Availability cluster command-line interface License: GPL-2.0+ Group: %{pkg_group} -Version: 2.2.0+git.1462967444.169c554 +Version: 2.2.0+git.1463777827.9b402a8 Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 @@ -170,6 +170,10 @@ %install make DESTDIR=%{buildroot} docdir=%{crmsh_docdir} install install -Dm0644 contrib/bash_completion.sh %{buildroot}%{_sysconfdir}/bash_completion.d/crm.sh +if [ -f %{buildroot}%{_bindir}/crm ]; then + install -Dm0755 %{buildroot}%{_bindir}/crm %{buildroot}%{_sbindir}/crm + rm %{buildroot}%{_bindir}/crm +fi %if 0%{?suse_version} %fdupes %{buildroot} %endif ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.QN4DjC/_old 2016-05-23 16:40:46.000000000 +0200 +++ /var/tmp/diff_new_pack.QN4DjC/_new 2016-05-23 16:40:46.000000000 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">169c5549accf42af8b89f6cc4d574c6c219768b1</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">9b402a8f9970f430a037dd0251ea88155d569ef4</param></service></servicedata> \ No newline at end of file ++++++ crmsh-2.2.0+git.1462967444.169c554.tar.bz2 -> crmsh-2.2.0+git.1463777827.9b402a8.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/.travis.yml new/crmsh-2.2.0+git.1463777827.9b402a8/.travis.yml --- old/crmsh-2.2.0+git.1462967444.169c554/.travis.yml 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/.travis.yml 2016-05-23 10:25:56.000000000 +0200 @@ -2,11 +2,15 @@ sudo: false language: python python: - - "2.6" - - "2.7" + - 2.6 + - 2.7 + install: - - "pip install -r requirements.txt" -script: ./test/run --with-coverage + - pip install tox-travis + +script: + - tox + notifications: irc: channels: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/AUTHORS new/crmsh-2.2.0+git.1463777827.9b402a8/AUTHORS --- old/crmsh-2.2.0+git.1462967444.169c554/AUTHORS 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/AUTHORS 2016-05-23 10:25:56.000000000 +0200 @@ -25,7 +25,7 @@ Motaharu Kobu <mkubo[at]3ware[dot]co[dot]jp> NAKAHIRA Kazutomo <nakahira[dot]kazutomo[at]oss[dot]ntt[dot]co[dot]jp> nozawat <nozawat[at]gmail[dot]com> - renayama19661014 <renayama19661014[at]ybb[dot]ne[dot]jp> + Pedro Salgado <steenzout[at]saucelabs[dot]com> Richard B Winters <rik[at]mmogp[dot]com> seabres <rainer[dot]brestan[at]gmx[dot]net> Tim Serong <tserong[at]suse[dot]com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/Makefile.am new/crmsh-2.2.0+git.1463777827.9b402a8/Makefile.am --- old/crmsh-2.2.0+git.1462967444.169c554/Makefile.am 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/Makefile.am 2016-05-23 10:25:56.000000000 +0200 @@ -20,8 +20,6 @@ # MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure -sbin_SCRIPTS = crm - # in .spec, set --sysconfdir=/etc # Documentation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/crmsh/history.py new/crmsh-2.2.0+git.1463777827.9b402a8/crmsh/history.py --- old/crmsh-2.2.0+git.1462967444.169c554/crmsh/history.py 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/crmsh/history.py 2016-05-23 10:25:56.000000000 +0200 @@ -130,9 +130,9 @@ "BLUE", "RED") session_sub = "session" - report_cache_dir = os.path.join(config.path.cache, 'history') - outdir = os.path.join(config.path.cache, 'history', "psshout") - errdir = os.path.join(config.path.cache, 'history', "pssherr") + report_cache_dir = os.path.join(config.path.cache, 'history-%s' % (utils.getuser())) + outdir = os.path.join(report_cache_dir, "psshout") + errdir = os.path.join(report_cache_dir, "pssherr") def __init__(self): # main source attributes @@ -243,9 +243,12 @@ if os.path.isfile(os.path.join(pp, 'cib.xml')): return p return os.path.isdir(pp) and self.find_node_log(p) - return sorted([os.path.basename(p) - for p in os.listdir(self.loc) - if check_node(p)]) + nodes = sorted([os.path.basename(p) + for p in os.listdir(self.loc) + if check_node(p)]) + if self.source == "live" and len(nodes) == 0: + nodes = [utils.this_node()] + return nodes def check_nodes(self): 'Verify if the nodes in cib match the nodes in the report.' @@ -316,6 +319,14 @@ l.append(log) else: self.warn("no log found for node %s" % node) + if self.source == "live" and node == utils.this_node(): + self.warn("Data collection fails if '%s' is not in sudoers file" % (utils.getuser())) + if len(l) == 0: + for lf in _LOG_FILES: + global_log = os.path.join(self.loc, lf) + if os.path.isfile(global_log): + l.append(global_log) + break return l def unpack_new_peinputs(self, node, pe_l): @@ -394,10 +405,9 @@ return rc1 and rc2 def get_live_report(self): - if not utils.acquire_lock(self.report_cache_dir): - return None - loc = self.new_live_report() - utils.release_lock(self.report_cache_dir) + loc = None + with utils.lock(self.report_cache_dir): + loc = self.new_live_report() return loc def manage_live_report(self, force=False, no_live_update=False): @@ -426,10 +436,11 @@ except: pass if _HAS_PARALLAX: - if not utils.acquire_lock(self.report_cache_dir): + rc = None + with utils.lock(self.report_cache_dir): + rc = self.update_live_report(next_loglines, next_peinputs) + if rc is None: return None - rc = self.update_live_report(next_loglines, next_peinputs) - utils.release_lock(self.report_cache_dir) if rc: self.set_change_origin(CH_UPD) return self._live_loc() @@ -912,7 +923,7 @@ try: f = open(fname, "wb") except IOError, msg: - common_err(msg) + common_err("Failed to save state: %s" % (msg)) return False p.write(f) f.close() @@ -927,7 +938,7 @@ try: p.read(fname) except Exception, msg: - common_err(msg) + common_err("Failed to load state: %s" % (msg)) return False rc = True try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/crmsh/logparser.py new/crmsh-2.2.0+git.1463777827.9b402a8/crmsh/logparser.py --- old/crmsh-2.2.0+git.1462967444.169c554/crmsh/logparser.py 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/crmsh/logparser.py 2016-05-23 10:25:56.000000000 +0200 @@ -220,10 +220,12 @@ self.cloned_resources = set() self.not_cloned_resources = set() + cib_elem = None if self.filename: cib_elem = xmlutil.file2cib_elem(self.filename) if cib_elem is None: + self.nodes = utils.list_cluster_nodes() return self.nodes = [x.get("uname") or x.get("id") for x in cib_elem.xpath("/cib/configuration/nodes/node")] @@ -606,9 +608,12 @@ Save state to cache file """ fn = self._metafile() - with open(fn, 'wb') as f: - json.dump(self.to_dict(), f, indent=2) - crmlog.common_debug("Transition metadata saved to %s" % (fn)) + try: + with open(fn, 'wb') as f: + json.dump(self.to_dict(), f, indent=2) + crmlog.common_debug("Transition metadata saved to %s" % (fn)) + except IOError as e: + crmlog.common_debug("Could not update metadata cache: %s" % (e)) def _load_cache(self): """ @@ -616,12 +621,15 @@ """ fn = self._metafile() if os.path.isfile(fn) and time.time() - os.stat(fn).st_mtime < _METADATA_CACHE_AGE: - with open(fn, 'rb') as f: - try: - if not self.from_dict(json.load(f)): - return False - crmlog.common_debug("Transition metadata loaded from %s" % (fn)) - return True - except ValueError as e: - crmlog.common_debug("Failed to load metadata: %s" % (e)) + try: + with open(fn, 'rb') as f: + try: + if not self.from_dict(json.load(f)): + return False + crmlog.common_debug("Transition metadata loaded from %s" % (fn)) + return True + except ValueError as e: + crmlog.common_debug("Failed to load metadata: %s" % (e)) + except IOError as e: + return False return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/crmsh/utils.py new/crmsh-2.2.0+git.1463777827.9b402a8/crmsh/utils.py --- old/crmsh-2.2.0+git.1462967444.169c554/crmsh/utils.py 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/crmsh/utils.py 2016-05-23 10:25:56.000000000 +0200 @@ -480,25 +480,35 @@ common_err("%s: %s" % (_LOCKDIR, strerror)) -def acquire_lock(lockdir): - check_locker(lockdir) - while True: - try: - os.makedirs(os.path.join(lockdir, _LOCKDIR)) - str2file("%d" % os.getpid(), os.path.join(lockdir, _LOCKDIR, _PIDF)) - return True - except OSError, (errno, strerror): - if errno != os.errno.EEXIST: - common_err(strerror) +@contextmanager +def lock(lockdir): + """ + Ensure that the lock is released properly + even in the face of an exception between + acquire and release. + """ + def acquire_lock(): + check_locker(lockdir) + while True: + try: + os.makedirs(os.path.join(lockdir, _LOCKDIR)) + str2file("%d" % os.getpid(), os.path.join(lockdir, _LOCKDIR, _PIDF)) + return True + except OSError, (errno, strerror): + if errno != os.errno.EEXIST: + common_err("Failed to acquire lock to %s: %s" %(lockdir, strerror)) + return False + time.sleep(0.1) + continue + else: return False - time.sleep(0.1) - continue - else: - return False - -def release_lock(lockdir): - rmdir_r(os.path.join(lockdir, _LOCKDIR)) + has_lock = acquire_lock() + try: + yield + finally: + if has_lock: + rmdir_r(os.path.join(lockdir, _LOCKDIR)) def pipe_cmd_nosudo(cmd): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/setup.py new/crmsh-2.2.0+git.1463777827.9b402a8/setup.py --- old/crmsh-2.2.0+git.1462967444.169c554/setup.py 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/setup.py 2016-05-23 10:25:56.000000000 +0200 @@ -4,9 +4,10 @@ from distutils.core import setup setup(name='crmsh', - version='2.2.0', + version='2.2.1', description='Command-line interface for High-Availability cluster management', author='Kristoffer Gronlund', author_email='kgronl...@suse.com', url='http://crmsh.github.io/', - packages=['crmsh']) + packages=['crmsh'], + scripts=['crm']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/test/testcases/history.exp new/crmsh-2.2.0+git.1463777827.9b402a8/test/testcases/history.exp --- old/crmsh-2.2.0+git.1462967444.169c554/test/testcases/history.exp 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/test/testcases/history.exp 2016-05-23 10:25:56.000000000 +0200 @@ -374,12 +374,12 @@ .INP: # reset timeframe .INP: timeframe .INP: session save _crmsh_regtest -.EXT mkdir -p /var/cache/crm/history/session/_crmsh_regtest +.EXT mkdir -p /var/cache/crm/history-root/session/_crmsh_regtest .INP: session load _crmsh_regtest .INP: session current session: _crmsh_regtest .INP: session pack -.EXT tar -C '/var/cache/crm/history/session/_crmsh_regtest/..' -cj -f '/root/_crmsh_regtest.tar.bz2' _crmsh_regtest +.EXT tar -C '/var/cache/crm/history-root/session/_crmsh_regtest/..' -cj -f '/root/_crmsh_regtest.tar.bz2' _crmsh_regtest Report saved in '/root/_crmsh_regtest.tar.bz2' .TRY History 2 .INP: history diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/test/unittests/test_gv.py new/crmsh-2.2.0+git.1463777827.9b402a8/test/unittests/test_gv.py --- old/crmsh-2.2.0+git.1462967444.169c554/test/unittests/test_gv.py 2016-05-12 10:40:53.000000000 +0200 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/test/unittests/test_gv.py 2016-05-23 10:25:56.000000000 +0200 @@ -2,9 +2,10 @@ # See COPYING for license information. +import re + from crmsh import crm_gv from crmsh import cibconfig -from nose.tools import eq_ def test_digits_ident(): @@ -16,11 +17,19 @@ g.new_node("a", top_node=True) g.new_attr("a", 'label', "a") - eq_("""digraph G { + expected = [ + 'fontname="Helvetica";', + 'fontsize="11";', + 'compound="true";', + '"1a" [label="1a"];', + 'a [label="a"];', + ] + out = '\n'.join(g.repr()).replace('\t', '') + + for line in re.match( + r'^digraph G {\n\n(?P<expected>.*)\n}$', out, re.M | re.S + ).group('expected').split('\n'): + assert line in expected + expected.remove(line) -fontname="Helvetica"; -fontsize="11"; -compound="true"; -"1a" [label="1a"]; -a [label="a"]; -}""", '\n'.join(g.repr()).replace('\t', '')) + assert len(expected) == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-2.2.0+git.1462967444.169c554/tox.ini new/crmsh-2.2.0+git.1463777827.9b402a8/tox.ini --- old/crmsh-2.2.0+git.1462967444.169c554/tox.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/crmsh-2.2.0+git.1463777827.9b402a8/tox.ini 2016-05-23 10:25:56.000000000 +0200 @@ -0,0 +1,17 @@ +[tox] +envlist = {py26,py27} +skipsdist = True + + +[testenv] +usedevelop = True +deps = + -rrequirements.txt + +passenv = HOME + +commands = + sh test/run --with-coverage + +whitelist_externals = + /bin/sh