Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2012-10-18 15:54:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh", Maintainer is "dmuhameda...@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2012-10-07 18:54:48.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2012-10-18 15:54:35.000000000 +0200 @@ -1,0 +2,23 @@ +Mon Oct 15 18:36:52 UTC 2012 - dmuhameda...@suse.com + +- report: adjust patterns for 1.1.8 +- ra: manage without glue installed (savannah#37560) +- cibconfig: show error message on id in use +- ui: readd quotes for single-shot commands +- upstream cs: b6bb311c7bd3 (crmsh-1.2.1) + +------------------------------------------------------------------- +Thu Oct 11 09:41:09 UTC 2012 - dmuhameda...@suse.com + +- cibconfig: repair edit for non-vi users +- cibconfig: node type is optional now +- ra: add support for crm_resource +- ra: improve support for RH fencing-agents +- utils: exit code of cibadmin -Q on no section changed in 1.1.8 +- history: add the exclude (log messages) command +- report: remove keyword 'as' which is not compatible with python + 2.4 (savannah#37534) +- build: replace StrictVersion with LooseVersion (savannah#37537) +- upstream cs: 1d38a7a06f04 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.XxiFwr/_old 2012-10-18 15:54:36.000000000 +0200 +++ /var/tmp/diff_new_pack.XxiFwr/_new 2012-10-18 15:54:36.000000000 +0200 @@ -45,7 +45,7 @@ Summary: Pacemaker command line interface License: GPL-2.0 Group: %{pkg_group} -Version: 1.2.0 +Version: 1.2.1 Release: 0 Url: http://savannah.nongnu.org/projects/crmsh Source0: crmsh.tar.bz2 ++++++ crmsh.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/.hg_archival.txt new/crmsh/.hg_archival.txt --- old/crmsh/.hg_archival.txt 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/.hg_archival.txt 2012-10-15 20:13:49.000000000 +0200 @@ -1,5 +1,5 @@ repo: 13c3bd69e935090cd25213c474cafc3f01b5910b -node: 0994b099c2dcf9bb5e85aa7aae3a9bed368942c7 +node: b6bb311c7bd36c05206f3a1cd98193ccf46d8da0 branch: default latesttag: crmsh-1.2.0 -latesttagdistance: 4 +latesttagdistance: 25 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/ChangeLog new/crmsh/ChangeLog --- old/crmsh/ChangeLog 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/ChangeLog 2012-10-15 20:13:49.000000000 +0200 @@ -1,3 +1,20 @@ +* Mon Oct 15 2012 Dejan Muhamedagic <de...@suse.de> and many others +- stable release 1.2.1 +- cibconfig: show error message on id in use +- cibconfig: repair edit for non-vi users +- cibconfig: update schema separately (don't remove the status section) +- cibconfig: node type is optional now +- ui: readd quotes for single-shot commands +- ra: manage without glue installed (savannah#37560) +- ra: improve support for RH fencing-agents +- ra: add support for crm_resource +- history: remove keyword 'as' which is not compatible with python + 2.4 (savannah#37534) +- history: add the exclude (log messages) command +- history: pacemaker 1.1.8 compatibility code +- utils: exit code of cibadmin -Q on no section changed in 1.1.8 +- some more pacemaker 1.1.8 compatibility code + * Tue Sep 18 2012 Dejan Muhamedagic <de...@suse.de> and many others - stable release 1.2.0 - cibconfig: support the kind attribute in orders diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/configure.ac new/crmsh/configure.ac --- old/crmsh/configure.ac 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/configure.ac 2012-10-15 20:13:49.000000000 +0200 @@ -21,7 +21,7 @@ dnl checks for library functions dnl checks for system services -AC_INIT(crmsh, 1.2.0, linux-ha@linux...@lists.linux-ha.org) +AC_INIT(crmsh, 1.2.1, linux-ha@linux...@lists.linux-ha.org) AC_ARG_WITH(version, [ --with-version=version Override package version (if you're a packager needing to pretend) ], @@ -190,11 +190,17 @@ AC_DEFINE_UNQUOTED(CRM_DTD_DIRECTORY,"$CRM_DTD_DIRECTORY", Where to keep CIB configuration files) AC_SUBST(CRM_DTD_DIRECTORY) -dnl Eventually move out of the heartbeat dir tree and create compatability code -dnl CRM_DAEMON_DIR=$libdir/pacemaker -GLUE_DAEMON_DIR=`extract_header_define $GLUE_HEADER GLUE_DAEMON_DIR` -AC_DEFINE_UNQUOTED(GLUE_DAEMON_DIR,"$GLUE_DAEMON_DIR", Location for Pacemaker daemons) -AC_SUBST(GLUE_DAEMON_DIR) +AC_PATH_PROGS(PKGCONFIG, pkg-config) +if test x"${PKGCONFIG}" = x""; then + AC_MSG_ERROR(You need pkgconfig installed in order to build ${PACKAGE}) +fi + +CRM_DAEMON_DIR=`$PKGCONFIG pcmk --variable=daemondir` +if test "X$CRM_DAEMON_DIR" = X; then + CRM_DAEMON_DIR=`extract_header_define $GLUE_HEADER GLUE_DAEMON_DIR` +fi +AC_DEFINE_UNQUOTED(CRM_DAEMON_DIR,"$CRM_DAEMON_DIR", Location for Pacemaker daemons) +AC_SUBST(CRM_DAEMON_DIR) CRM_CACHE_DIR=${localstatedir}/cache/crm AC_DEFINE_UNQUOTED(CRM_CACHE_DIR,"$CRM_CACHE_DIR", Where crm shell keeps the cache) @@ -245,7 +251,6 @@ PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin" export PATH - dnl Replacing AC_PROG_LIBTOOL with AC_CHECK_PROG because LIBTOOL dnl was NOT being expanded all the time thus causing things to fail. AM_PATH_PYTHON @@ -256,7 +261,6 @@ AC_PATH_PROGS(TAR, tar) AC_PATH_PROGS(MD5, md5) AC_PATH_PROGS(TEST, test) -AC_PATH_PROGS(PKGCONFIG, pkg-config) AM_CONDITIONAL(BUILD_ASCIIDOC, test x"${ASCIIDOC}" != x"") if test x"${ASCIIDOC}" != x""; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/crmsh.spec new/crmsh/crmsh.spec --- old/crmsh/crmsh.spec 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/crmsh.spec 2012-10-15 20:13:49.000000000 +0200 @@ -17,7 +17,7 @@ Name: crmsh Summary: Pacemaker command line interface -Version: 1.2.0 +Version: 1.2.1 Release: %{crmsh_release}%{?dist} License: GPLv2+ Url: http://www.clusterlabs.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/doc/crm.8.txt new/crmsh/doc/crm.8.txt --- old/crmsh/doc/crm.8.txt 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/doc/crm.8.txt 2012-10-15 20:13:49.000000000 +0200 @@ -2953,6 +2953,25 @@ log node-a ............... +[[cmdhelp_history_exclude,exclude log messages]] +==== `exclude` + +If a log is infested with irrelevant messages, those messages may +be excluded by specifying a regular expression. The regular +expressions used are Python extended. This command is additive. +To drop all regular expressions, use `exclude clear`. Run +`exclude` only to see the current list of regular expressions. +Excludes are saved along with the history sessions. + +Usage: +............... + exclude [<regex>|clear] +............... +Example: +............... + exclude kernel.*ocfs2 +............... + [[cmdhelp_history_peinputs,list or get PE input files]] ==== `peinputs` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/cibconfig.py new/crmsh/modules/cibconfig.py --- old/crmsh/modules/cibconfig.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/cibconfig.py 2012-10-15 20:13:49.000000000 +0200 @@ -344,6 +344,7 @@ '''Extra processing of the string to be editted''' if user_prefs.editor.startswith("vi"): return "%s\n#vim:set syntax=pcmk\n" % s + return s def process(self, cli_list, update = False): ''' Create new objects or update existing ones. @@ -1010,7 +1011,7 @@ s = '%s $id="%s"' % (s, self.obj_id) s = '%s %s' % (s, cli_display.id(uname)) type = self.node.getAttribute("type") - if type != vars.node_default_type: + if type and type != vars.node_default_type: s = '%s:%s' % (s, type) return s def cli_list2node(self,cli_list,oldnode): @@ -1022,8 +1023,9 @@ if not obj_id: return None type = find_value(head[1],"type") - if not type: + if not vars.node_type_opt and not type: type = vars.node_default_type + if type: head[1].append(["type",type]) headnode = mkxmlsimple(head,get_topnode(cib_factory.doc,self.parent_type),'node') id_hint = headnode.getAttribute("uname") @@ -2143,7 +2145,7 @@ return symm and symm != "true" def new_object(self,obj_type,obj_id): "Create a new object of type obj_type." - if obj_id and self.find_object(obj_id): + if obj_id and id_store.id_in_use(obj_id): return None for xml_obj_type,v in cib_object_map.items(): if v[0] == obj_type: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/help.py.in new/crmsh/modules/help.py.in --- old/crmsh/modules/help.py.in 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/help.py.in 2012-10-15 20:13:49.000000000 +0200 @@ -179,8 +179,11 @@ short_tab = self.get_short_help(help_tab) l = [s] for t,d in short_tab: - if self.is_level(t): - t = "%s/" % t +# TODO: figure out how to make appending '/' work _only_ in case +# t is really a level, becase some commands share name with +# levels (e.g. history resource, history node) +# if self.is_level(t): +# t = "%s/" % t l.append("\t%-16s %s" % (t,d)) page_string("\n".join(l)) def cmd_help(self,help_tab,topic = ''): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/log_patterns.py new/crmsh/modules/log_patterns.py --- old/crmsh/modules/log_patterns.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/log_patterns.py 2012-10-15 20:13:49.000000000 +0200 @@ -22,17 +22,17 @@ log_patterns = { "resource": ( ( # detail 0 - "lrmd:.*rsc:%% (start|stop|promote|demote|migrate)", - "lrmd:.*RA output: .%%:.*:stderr", - "lrmd:.*WARN: Managed %%:.*exited", - "lrmd:.*WARN: .* %% .*timed out$", - "crmd:.*process_lrm_event: LRM operation %%_(start|stop|promote|demote|migrate)_.*confirmed=true", - "crmd:.*process_lrm_event: LRM operation %%_.*Timed Out", + "lrmd.*rsc:%% (start|stop|promote|demote|migrate)", + "lrmd.*RA output: .%%:.*:stderr", + "lrmd.*WARN: Managed %%:.*exited", + "lrmd.*WARN: .* %% .*timed out$", + "crmd.*process_lrm_event: LRM operation %%_(start|stop|promote|demote|migrate)_.*confirmed=true", + "crmd.*process_lrm_event: LRM operation %%_.*Timed Out", "[(]%%[)][[]", ), ( # detail 1 - "lrmd:.*rsc:%% (probe|notify)", - "lrmd:.*info: Managed %%:.*exited", + "lrmd.*rsc:%% (probe|notify)", + "lrmd.*info: Managed %%:.*exited", ), ), "node": ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/main.py new/crmsh/modules/main.py --- old/crmsh/modules/main.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/main.py 2012-10-15 20:13:49.000000000 +0200 @@ -290,8 +290,23 @@ vars.tmpl_conf_dir = xdg_file(vars.tmpl_conf_dir, \ vars.xdg_map["crmconf"], "d", "config") +def compatibility(): + from distutils.version import LooseVersion + try: + vars.pcmk_version = get_stdout("crmd version").split()[2] + if LooseVersion(vars.pcmk_version) >= LooseVersion("1.1.8"): + vars.node_type_opt = True + vars.attr_defaults["node"] = {"type": "normal"} + vars.cib_no_section_rc = 6 + vars.transition_patt[0] = "pengine.* process_pe_message: Calculated Transition ([0-9]+): (.*/pe-[^-]+-(%%)[.]bz2)" # transition start + except Exception,msg: + vars.pcmk_version = "1.1.1" + common_warn(msg) + common_warn("could not get the pacemaker version, bad installation?") + def do_work(): global user_args + compatibility() # this special case is silly, but we have to keep it to # preserve the backward compatibility if len(user_args) == 1 and user_args[0].startswith("conf"): @@ -301,7 +316,20 @@ # we're not sure yet whether it's an interactive session or not # (single-shot commands aren't) options.interactive = False - if parse_line(levels,shlex.split(' '.join(user_args))): + # add quotes if there's whitespace in one of the + # arguments; so that the user doesn't need to protect the + # quotes; but if there are two kinds of quotes which + # actually _survive_ the getopt, then we're _probably_ + # screwed + # at any rate, stuff like ... '..."..."' as well as + # '...\'...\'' do work + l = [] + for s in user_args: + if ' ' in s and not ('"' in s or "'" in s): + q = '"' + s = "%s%s%s" % (q,s,q) + l.append(s) + if parse_line(levels,shlex.split(' '.join(l))): # if the user entered a level, then just continue if not levels.previous(): sys.exit(0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/ra.py new/crmsh/modules/ra.py --- old/crmsh/modules/ra.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/ra.py 2012-10-15 20:13:49.000000000 +0200 @@ -76,7 +76,10 @@ l = stdout2list("%s/resource.d/%s/%s meta-data" % \ (os.environ["OCF_ROOT"],ra_provider,ra_type)) elif ra_class == "stonith": - l = stdout2list("stonith -m -t %s" % ra_type) + if ra_type.startswith("fence_") and os.path.exists("/usr/sbin/%s" % ra_type): + l = stdout2list("/usr/sbin/%s -o metadata" % ra_type) + else: + l = stdout2list("stonith -m -t %s" % ra_type) return l def providers(self, ra_type,ra_class = "ocf"): 'List of providers for a class:type.' @@ -100,24 +103,66 @@ l = os_types_list("/etc/init.d/*") elif ra_class == "stonith": l = stdout2list("stonith -L") + l.extend(os_types_list("/usr/sbin/fence_*")) l = list(set(l)) l.sort() + if ra_class == "stonith": + for ra in ("fence_ack_manual", "fence_pcmk", "fence_legacy"): + if l.count(ra): + l.remove(ra) return l +class RaCrmResource(object): + ''' + Getting information from the resource agents via new crm_resource. + ''' + def __init__(self): + self.good = True + def crm_resource(self, opts): + ''' + Get information from crm_resource. + ''' + return stdout2list("crm_resource %s" % opts, stderr_on=False) + def meta(self, ra_class,ra_type,ra_provider): + return self.crm_resource("--show-metadata %s:%s:%s"%(ra_class,ra_provider,ra_type)) + def providers(self, ra_type,ra_class = "ocf"): + 'List of providers for OCF:type.' + if ra_class != "ocf": + common_err("no providers for class %s" % ra_class) + return [] + return self.crm_resource("--list-ocf-alternatives %s" % ra_type) + def classes(self): + 'List of classes.' + l = self.crm_resource("--list-standards") + return l + def types(self, ra_class = "ocf", ra_provider = ""): + 'List of types for a class.' + if ra_provider: + return self.crm_resource("--list-agents %s:%s" % (ra_class,ra_provider)) + else: + return self.crm_resource("--list-agents %s" % ra_class) + def can_use_lrmadmin(): from distutils import version # after this glue release all users can get meta-data and # similar from lrmd minimum_glue = "1.0.10" glue_ver = get_stdout("%s -v" % lrmadmin_prog, stderr_on = False) - v_min = version.StrictVersion(minimum_glue) - v_this = version.StrictVersion(glue_ver) + if not glue_ver: #lrmadmin probably not found + return False + v_min = version.LooseVersion(minimum_glue) + v_this = version.LooseVersion(glue_ver) return v_this >= v_min or \ (getpwdent()[0] in ("root",vars.crm_daemon_user)) +def crm_resource_support(): + s = get_stdout("crm_resource --list-standards", stderr_on = False) + return s != "" def ra_if(): if vars.ra_if: return vars.ra_if - if can_use_lrmadmin(): + if crm_resource_support(): + vars.ra_if = RaCrmResource() + elif can_use_lrmadmin(): vars.ra_if = RaLrmd() if not vars.ra_if or not vars.ra_if.good: vars.ra_if = RaOS() @@ -463,9 +508,12 @@ n_ops[n_op][p] = v for req_op in self.required_ops: if req_op not in n_ops: - n_ops[req_op] = {} + if not (self.ra_class == "stonith" and req_op in ("start", "stop")): + n_ops[req_op] = {} intervals = {} for op in n_ops: + if self.ra_class == "stonith" and op in ("start", "stop"): + continue if op not in self.actions(): common_warn("%s: action %s not advertised in meta-data, it may not be supported by the RA" % (id,op)) rc |= 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/report.py new/crmsh/modules/report.py --- old/crmsh/modules/report.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/report.py 2012-10-15 20:13:49.000000000 +0200 @@ -22,6 +22,7 @@ import copy import re import glob +import ConfigParser from singletonmixin import Singleton from userprefs import Options, UserPrefs @@ -364,17 +365,6 @@ except: return "-1" -# r.group(1) transition number (a different thing from file number) -# r.group(2) contains full path -# r.group(3) file number -transition_patt = ( - "crmd: .* do_te_invoke: Processing graph ([0-9]+) .*derived from (.*/pe-[^-]+-(%%)[.]bz2)", # transition start - "crmd: .* run_graph: .*Transition ([0-9]+).*Source=(.*/pe-[^-]+-(%%)[.]bz2).: (Stopped|Complete|Terminated)", # and stop -# r.group(1) transition number -# r.group(2) number of actions - "crmd: .* run_graph: .*Transition (%%) .*Complete=([0-9]+),", # number of actions -) - def run_graph_msg_actions(msg): ''' crmd: [13667]: info: run_graph: Transition 399 (Complete=5, @@ -395,11 +385,16 @@ ''' # check if there were any actions in this transition pe_num = get_pe_num(pe_file) - te_invoke_patt = transition_patt[0].replace("%%", pe_num) - run_patt = transition_patt[1].replace("%%", pe_num) + if pe_num == "-1": + common_debug("no PE number for file: %s" % pe_file) + return -1 + te_invoke_patt = vars.transition_patt[0].replace("%%", pe_num) + run_patt = vars.transition_patt[1].replace("%%", pe_num) r = re.search(te_invoke_patt, te_invoke_msg) + if not r: + return -1 trans_num = r.group(1) - unpack_patt = transition_patt[2].replace("%%", trans_num) + unpack_patt = vars.transition_patt[2].replace("%%", trans_num) for msg in msg_l: try: return int(re.search(unpack_patt, msg).group(2)) @@ -458,6 +453,8 @@ self.outdir = os.path.join(vars.report_cache,"psshout") self.errdir = os.path.join(vars.report_cache,"pssherr") self.last_live_update = 0 + self.log_filter_out = [] + self.log_filter_out_re = [] def error(self, s): common_err("%s: %s" % (self.source, s)) def warn(self, s): @@ -671,7 +668,8 @@ self.last_live_update = time.time() return (rc1 and rc2) def get_live_report(self): - acquire_lock(vars.report_cache) + if not acquire_lock(vars.report_cache): + return None loc = self.new_live_hb_report() release_lock(vars.report_cache) return loc @@ -687,7 +685,8 @@ self.loc = d self.report_setup() if not force and self.is_last_live_recent(): - acquire_lock(vars.report_cache) + if not acquire_lock(vars.report_cache): + return None rc = self.update_live() release_lock(vars.report_cache) if rc: @@ -795,7 +794,7 @@ build it from the collected log files (self.logobj). Otherwise, we get matches for transition patterns. ''' - trans_re_l = [x.replace("%%", "[0-9]+") for x in transition_patt] + trans_re_l = [x.replace("%%", "[0-9]+") for x in vars.transition_patt] if not msg_l: msg_l = self.logobj.get_matches(trans_re_l) else: @@ -808,17 +807,16 @@ # this looks too short common_warn("log message <%s> unexpected format, please report a bug" % msg) continue - if msg_a[7] in ("unpack_graph:","run_graph:"): + if "run_graph:" in msg: continue # we want another message + common_debug("trans msg use: %s" % msg_a) node = msg_a[3] pe_file = msg_a[-1] pe_base = os.path.basename(pe_file) num_actions = transition_actions(msg_l, msg, pe_file) - if num_actions == 0: # empty transition + if num_actions <= 0: # empty transition common_debug("skipping empty transition (%s)" % pe_base) continue - elif num_actions == -1: # couldn't find messages - common_warn("could not find number of actions for transition (%s)" % pe_base) if not future_pe: pe_l_file = os.path.join(self.loc, node, "pengine", pe_base) if not os.path.isfile(pe_l_file): @@ -911,7 +909,14 @@ # ${..} in logs? s = s.replace("${","$.{") return "${%s}%s${NORMAL}" % (clr,s) + def match_filter_out(self, s): + for re in self.log_filter_out_re: + if re.search(s): + return True + return False def display_logs(self, l): + if self.log_filter_out_re: + l = [x for x in l if not self.match_filter_out(x)] page_string('\n'.join([ self.disp(x) for x in l ])) def show_logs(self, log_l = None, re_l = []): ''' @@ -971,14 +976,14 @@ self.show_logs(re_l = all_re_l) def get_transition_msgs(self, pe_file, msg_l = None): if not msg_l: - trans_re_l = [x.replace("%%", "[0-9]+") for x in transition_patt] + trans_re_l = [x.replace("%%", "[0-9]+") for x in vars.transition_patt] msg_l = self.logobj.get_matches(trans_re_l) te_invoke_msg = "" run_msg = "" unpack_msg = "" pe_num = get_pe_num(pe_file) - te_invoke_patt = transition_patt[0].replace("%%", pe_num) - run_patt = transition_patt[1].replace("%%", pe_num) + te_invoke_patt = vars.transition_patt[0].replace("%%", pe_num) + run_patt = vars.transition_patt[1].replace("%%", pe_num) r = None msg_l.reverse() for msg in msg_l: @@ -989,7 +994,7 @@ if not r: return ["", "", ""] trans_num = r.group(1) - unpack_patt = transition_patt[2].replace("%%", trans_num) + unpack_patt = vars.transition_patt[2].replace("%%", trans_num) for msg in msg_l: if re.search(run_patt, msg): run_msg = msg @@ -1129,7 +1134,6 @@ - detail TODO ''' - import ConfigParser p = ConfigParser.SafeConfigParser() p.add_section(self.rpt_section) p.set(self.rpt_section, 'dir', \ @@ -1139,6 +1143,7 @@ p.set(self.rpt_section, 'to_time', \ self.to_dt and human_date(self.to_dt) or '') p.set(self.rpt_section, 'detail', str(self.detail)) + self.manage_excludes("save", p) fname = os.path.join(dir, self.state_file) try: f = open(fname,"wb") @@ -1152,7 +1157,6 @@ ''' Load the history state from a file. ''' - import ConfigParser p = ConfigParser.SafeConfigParser() fname = os.path.join(dir, self.state_file) try: @@ -1178,12 +1182,13 @@ else: common_warn("unknown item %s in the " "session state file %s" % (n, fname)) + rc |= self.manage_excludes("load", p) except ConfigParser.NoSectionError, msg: common_err("session state file %s: %s" % (fname, msg)) rc = False except Exception, msg: - common_err("bad value for '%s' in " - "session state file %s" % (n, v, fname)) + common_err("%s: bad value '%s' for '%s' in " + "session state file %s" % (msg, v, n, fname)) rc = False return rc def manage_session(self, subcmd, name): @@ -1214,6 +1219,46 @@ elif subcmd == "pack": return mkarchive(dir) return True + log_section = 'log' + def manage_excludes(self, cmd, arg=None): + '''Exclude messages from log files. + arg: None (show, clear) + regex (add) + instance of ConfigParser.SafeConfigParser (load, save) + ''' + if not self.prepare_source(): + return False + rc = True + if cmd == "show": + print '\n'.join(self.log_filter_out) + elif cmd == "clear": + self.log_filter_out = [] + self.log_filter_out_re = [] + elif cmd == "add": + try: + regex = re.compile(arg) + self.log_filter_out.append(arg) + self.log_filter_out_re.append(regex) + except Exception,msg: + common_err("bad regex %s: %s" % (arg, msg)) + rc = False + elif cmd == "save" and self.log_filter_out: + arg.add_section(self.log_section) + for i in range(len(self.log_filter_out)): + arg.set(self.log_section, 'exclude_%d' % i, \ + self.log_filter_out[i]) + elif cmd == "load": + self.manage_excludes("clear") + try: + for n, v in arg.items(self.log_section): + if n.startswith('exclude_'): + rc |= self.manage_excludes("add", v) + else: + common_warn("unknown item %s in the " + "section %s" % (n, self.log_section)) + except ConfigParser.NoSectionError: + pass + return rc vars = Vars.getInstance() options = Options.getInstance() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/ui.py.in new/crmsh/modules/ui.py.in --- old/crmsh/modules/ui.py.in 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/ui.py.in 2012-10-15 20:13:49.000000000 +0200 @@ -1757,6 +1757,7 @@ self.cmd_table["peinputs"] = (self.peinputs,(0,),1,0) self.cmd_table["transition"] = (self.transition,(0,),1,0) self.cmd_table["session"] = (self.session,(0,2),1,0) + self.cmd_table["exclude"] = (self.exclude,(0,1),1,0) self.cmd_aliases.update({ "limit": ("timeframe",), }) @@ -1997,6 +1998,15 @@ common_info("current history session deleted, setting source to live") self._set_source("live") return rc + def exclude(self, cmd, arg=None): + "usage: exclude [<regex>|clear]" + if not arg: + rc = crm_report.manage_excludes("show") + elif arg == "clear": + rc = crm_report.manage_excludes("clear") + else: + rc = crm_report.manage_excludes("add", arg) + return rc class Site(UserInterface): ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/utils.py new/crmsh/modules/utils.py --- old/crmsh/modules/utils.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/utils.py 2012-10-15 20:13:49.000000000 +0200 @@ -265,12 +265,12 @@ return try: os.kill(pid, 0) - except OSError, err: - if err.errno == os.errno.ESRCH: + except OSError, (errno, strerror): + if errno == os.errno.ESRCH: common_info("history: removing stale lock") rmdir_r(os.path.join(dir,_LOCKDIR)) else: - common_err("%s: %s" % (_LOCKDIR,err.message)) + common_err("%s: %s" % (_LOCKDIR,strerror)) def acquire_lock(dir): check_locker(dir) while True: @@ -278,7 +278,7 @@ os.mkdir(os.path.join(dir,_LOCKDIR)) str2file("%d" % os.getpid(),os.path.join(dir,_LOCKDIR,_PIDF)) return True - except OSError as (errno, strerror): + except OSError, (errno, strerror): if errno != os.errno.EEXIST: common_err(strerror) return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/vars.py.in new/crmsh/modules/vars.py.in --- old/crmsh/modules/vars.py.in 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/vars.py.in 2012-10-15 20:13:49.000000000 +0200 @@ -176,6 +176,8 @@ "resource_set": {"sequential": "true", "require-all": "true"}, "rule": {"boolean-op": "and"}, } + node_type_opt = False + cib_no_section_rc = 22 prompt = '' tmpfiles = [] @@ -200,7 +202,7 @@ crm_schema_dir = "@CRM_DTD_DIRECTORY@" pe_dir = "@PE_STATE_DIR@" crm_conf_dir = "@CRM_CONFIG_DIR@" - crm_daemon_dir = "@GLUE_DAEMON_DIR@" + crm_daemon_dir = "@CRM_DAEMON_DIR@" crm_daemon_user = "@CRM_DAEMON_USER@" crm_version = "@VERSION@ (Build @BUILD_VERSION@)" @@ -225,4 +227,15 @@ ocf_root = "/usr/lib/ocf" os.environ["OCF_ROOT"] = ocf_root + # r.group(1) transition number (a different thing from file number) + # r.group(2) contains full path + # r.group(3) file number + transition_patt = [ + "crmd.* do_te_invoke: Processing graph ([0-9]+) .*derived from (.*/pe-[^-]+-(%%)[.]bz2)", # transition start + "crmd.* run_graph: .*Transition ([0-9]+).*Source=(.*/pe-[^-]+-(%%)[.]bz2).: (Stopped|Complete|Terminated)", # and stop + # r.group(1) transition number + # r.group(2) number of actions + "crmd.* run_graph: .*Transition (%%) .*Complete=([0-9]+),", # number of actions + ] + # vim:ts=4:sw=4:et: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/xmlutil.py new/crmsh/modules/xmlutil.py --- old/crmsh/modules/xmlutil.py 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/modules/xmlutil.py 2012-10-15 20:13:49.000000000 +0200 @@ -84,7 +84,7 @@ except xml.parsers.expat.ExpatError,msg: cib_parse_err(msg,outp) return None - elif rc == 22: + elif rc == vars.cib_no_section_rc: return None else: common_error("running %s: %s" % (cmd,err_outp)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/test/testcases/node new/crmsh/test/testcases/node --- old/crmsh/test/testcases/node 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/test/testcases/node 2012-10-15 20:13:49.000000000 +0200 @@ -6,6 +6,3 @@ node attribute node1 set a1 "1 2 3" node attribute node1 show a1 node attribute node1 delete a1 -node status-attr node1 set s1 "1 2 3" -node status-attr node1 show s1 -node status-attr node1 delete s1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/test/testcases/node.exp new/crmsh/test/testcases/node.exp --- old/crmsh/test/testcases/node.exp 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/test/testcases/node.exp 2012-10-15 20:13:49.000000000 +0200 @@ -113,67 +113,3 @@ </configuration> </cib> -.TRY node status-attr node1 set s1 "1 2 3" -.EXT crm_attribute -t status -U 'node1' -n 's1' -v '1 2 3' -.INP: configure -.INP: _regtest on -.INP: show xml node1 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes> - <node id="node1" type="normal" uname="node1"> - <instance_attributes id="nodes-node1"> - <nvpair id="nodes-node1-standby" name="standby" value="off"/> - </instance_attributes> - </node> - </nodes> - <resources/> - <constraints/> - </configuration> -</cib> - -.TRY node status-attr node1 show s1 -.EXT crm_attribute -G -t status -U 'node1' -n 's1' -scope=status name=s1 value=(null) -.INP: configure -.INP: _regtest on -.INP: show xml node1 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes> - <node id="node1" type="normal" uname="node1"> - <instance_attributes id="nodes-node1"> - <nvpair id="nodes-node1-standby" name="standby" value="off"/> - </instance_attributes> - </node> - </nodes> - <resources/> - <constraints/> - </configuration> -</cib> - -.TRY node status-attr node1 delete s1 -.EXT crm_attribute -D -t status -U 'node1' -n 's1' -.INP: configure -.INP: _regtest on -.INP: show xml node1 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes> - <node id="node1" type="normal" uname="node1"> - <instance_attributes id="nodes-node1"> - <nvpair id="nodes-node1-standby" name="standby" value="off"/> - </instance_attributes> - </node> - </nodes> - <resources/> - <constraints/> - </configuration> -</cib> - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/test/testcases/resource new/crmsh/test/testcases/resource --- old/crmsh/test/testcases/resource 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/test/testcases/resource 2012-10-15 20:13:49.000000000 +0200 @@ -6,7 +6,6 @@ resource manage c1 resource unmanage c1 %setenv showobj=cli-prefer-p3 -resource migrate p3 resource migrate p3 node1 resource unmigrate p3 %setenv showobj=p0 @@ -16,8 +15,3 @@ resource meta p0 set m0 123 resource meta p0 show m0 resource meta p0 delete m0 -resource failcount p0 set node1 5 -resource failcount p0 show node1 -resource failcount p0 delete node1 -resource cleanup p0 node1 -resource cleanup p0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/test/testcases/resource.exp new/crmsh/test/testcases/resource.exp --- old/crmsh/test/testcases/resource.exp 2012-09-27 19:36:05.000000000 +0200 +++ new/crmsh/test/testcases/resource.exp 2012-10-15 20:13:49.000000000 +0200 @@ -86,23 +86,6 @@ </cib> .SETENV showobj=cli-prefer-p3 -.TRY resource migrate p3 -.EXT crm_resource -M -r 'p3' -Resource p3 not moved: not-active and no preferred location specified. -Error performing operation: cib object missing -.INP: configure -.INP: _regtest on -.INP: show xml cli-prefer-p3 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes/> - <resources/> - <constraints/> - </configuration> -</cib> - .TRY resource migrate p3 node1 .EXT crm_resource -M -r 'p3' --node='node1' .INP: configure @@ -250,94 +233,6 @@ .INP: configure .INP: _regtest on .INP: show xml p0 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes/> - <resources> - <primitive class="ocf" id="p0" provider="pacemaker" type="Dummy"/> - </resources> - <constraints/> - </configuration> -</cib> - -.TRY resource failcount p0 set node1 5 -.EXT crm_attribute -t status -n 'fail-count-p0' -N 'node1' -v '5' -d 0 -.INP: configure -.INP: _regtest on -.INP: show xml p0 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes/> - <resources> - <primitive class="ocf" id="p0" provider="pacemaker" type="Dummy"/> - </resources> - <constraints/> - </configuration> -</cib> - -.TRY resource failcount p0 show node1 -.EXT crm_attribute -t status -n 'fail-count-p0' -N 'node1' -G -d 0 -scope=status name=fail-count-p0 value=0 -.INP: configure -.INP: _regtest on -.INP: show xml p0 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes/> - <resources> - <primitive class="ocf" id="p0" provider="pacemaker" type="Dummy"/> - </resources> - <constraints/> - </configuration> -</cib> - -.TRY resource failcount p0 delete node1 -.EXT crm_attribute -t status -n 'fail-count-p0' -N 'node1' -D -d 0 -.INP: configure -.INP: _regtest on -.INP: show xml p0 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes/> - <resources> - <primitive class="ocf" id="p0" provider="pacemaker" type="Dummy"/> - </resources> - <constraints/> - </configuration> -</cib> - -.TRY resource cleanup p0 node1 -.EXT crm_resource -C -r 'p0' -H 'node1' -Error performing operation: connection failed -.INP: configure -.INP: _regtest on -.INP: show xml p0 -<?xml version="1.0" ?> -<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> - <configuration> - <crm_config/> - <nodes/> - <resources> - <primitive class="ocf" id="p0" provider="pacemaker" type="Dummy"/> - </resources> - <constraints/> - </configuration> -</cib> - -.TRY resource cleanup p0 -.EXT crm_resource -C -r 'p0' -Error performing operation: connection failed -.INP: configure -.INP: _regtest on -.INP: show xml p0 <?xml version="1.0" ?> <cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="f36760d8-d84a-46b2-b452-4c8cac8b3396" epoch="0" have-quorum="1" num_updates="1" remote-tls-port="0" validate-with="pacemaker-1.1"> <configuration> -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org