Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2012-05-03 10:54:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2012-02-16 12:19:23.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2012-05-03 10:54:51.000000000 +0200 @@ -1,0 +2,33 @@ +Mon Apr 23 10:59:48 UTC 2012 - [email protected] + +- Add libxslt-tools to BuildRequires + +------------------------------------------------------------------- +Thu Mar 29 08:15:31 UTC 2012 - [email protected] + +- Change how appropriate version of pacemaker for ticket support is + required (bnc#752241) + +------------------------------------------------------------------- +Tue Mar 27 12:59:13 UTC 2012 - [email protected] + +- drop dependency on python-xdg (lives in SDK repo) + +------------------------------------------------------------------- +Tue Mar 27 12:34:51 UTC 2012 - [email protected] + +- add Requires pacemaker >= 1.1.6-2 to the spec file + +------------------------------------------------------------------- +Mon Mar 26 15:52:23 UTC 2012 - [email protected] + +- move user files to standard locations (XDG) +- site: ticket standby and activate commands +- cibstatus: ticket management +- site: update interface to crm_ticket +- cibconf: use uname instead of id when listing nodes (cl#5043) +- ra: use only effective UID when choosing RA interface +- ra: always use lrmadmin with glue 1.0.10 (cl#5036) +- upstream cs: 9569a7f283cb + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.GOziAd/_old 2012-05-03 10:54:52.000000000 +0200 +++ /var/tmp/diff_new_pack.GOziAd/_new 2012-05-03 10:54:52.000000000 +0200 @@ -44,26 +44,35 @@ Url: http://savannah.nongnu.org/projects/crmsh Source0: crmsh.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build -Requires(pre): pacemaker +Requires(pre): pacemaker-ticket-support >= 2.0 +Requires(pre): pacemaker >= 1.1.6 +Requires: pssh Requires: python >= 2.4 -Requires: pssh python-dateutil +Requires: python-dateutil %if 0%{?suse_version} # Suse splits this off into a separate package -Requires: python-curses python-xml +Requires: python-curses +Requires: python-xml BuildRequires: python-curses BuildRequires: python-xml %endif # Required for core functionality +BuildRequires: asciidoc BuildRequires: autoconf BuildRequires: automake -BuildRequires: pkgconfig -BuildRequires: python BuildRequires: libglue-devel BuildRequires: libpacemaker-devel -BuildRequires: asciidoc BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: python +%if 0%{?suse_version} > 1210 +# xsltproc is necessary for manpage generation; this is split out into +# libxslt-tools as of openSUSE 12.2. Possibly strictly should be +# required by asciidoc +BuildRequires: libxslt-tools +%endif %if 0%{?with_regression_tests} BuildRequires: corosync ++++++ 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/.hg_archival.txt 2012-03-26 17:48:33.000000000 +0200 @@ -1,5 +1,5 @@ repo: 13c3bd69e935090cd25213c474cafc3f01b5910b -node: c06b8cf8fcf8d4345157048974313aaf48db1ef8 +node: 9569a7f283cba50c9ce5f862d5da8e70556f70d2 branch: default latesttag: Pacemaker-1.1.5 -latesttagdistance: 96 +latesttagdistance: 104 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/crmsh.spec new/crmsh/crmsh.spec --- old/crmsh/crmsh.spec 2012-02-03 12:13:57.000000000 +0100 +++ new/crmsh/crmsh.spec 2012-03-26 17:48:33.000000000 +0200 @@ -26,7 +26,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReqProv: on Requires(pre): pacemaker -Requires: python >= 2.4 +Requires: python >= 2.4 python-xdg %if 0%{?suse_version} # Suse splits this off into a separate package 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/doc/crm.8.txt 2012-03-26 17:48:33.000000000 +0200 @@ -1155,7 +1155,7 @@ Usage: ............... - ticket {grant|revoke|show|time|delete} <ticket> + ticket {grant|revoke|standby|activate|show|time|delete} <ticket> ............... Example: ............... @@ -1335,7 +1335,7 @@ [[cmdhelp_options_save,save the user preferences to the rc file]] ==== `save` -Save current settings to the rc file (`$HOME/.crm.rc`). On +Save current settings to the rc file (`$HOME/.config/crm/rc`). On further `crm` runs, the rc file is automatically read and parsed. [[cmdhelp_configure,CIB configuration]] @@ -2452,6 +2452,21 @@ quorum false ............... +[[cmdhelp_cibstatus_ticket,manage tickets]] +==== `ticket` + +Modify the ticket status. Tickets can be granted and revoked. +Granted tickets could be activated or put in standby. + +Usage: +............... + ticket <ticket> {grant|revoke|activate|standby} +............... +Example: +............... + ticket ticketA grant +............... + [[cmdhelp_cibstatus_run,run policy engine]] ==== `run` 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/cibconfig.py 2012-03-26 17:48:33.000000000 +0200 @@ -1785,7 +1785,7 @@ if x.obj_type in vars.resource_tags and not x.parent] def node_id_list(self): "List of node ids." - return [x.obj_id for x in self.cib_objects \ + return [x.node.getAttribute("uname") for x in self.cib_objects \ if x.obj_type == "node"] def f_prim_id_list(self): "List of possible primitives ids (for group completion)." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/cibstatus.py new/crmsh/modules/cibstatus.py --- old/crmsh/modules/cibstatus.py 2012-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/cibstatus.py 2012-03-26 17:48:33.000000000 +0200 @@ -90,6 +90,12 @@ "offline": "-d", "unclean": "-f", } + ticket_ops = { + "grant": "-g", + "revoke": "-r", + "standby": "-b", + "activate": "-e", + } def __init__(self): self.origin = "live" self.backing_file = "" # file to keep the live cib @@ -130,6 +136,7 @@ self.quorum = '' self.node_changes = {} self.op_changes = {} + self.ticket_changes = {} return True def source_file(self): if self.origin == "live": @@ -242,6 +249,8 @@ print node,self.node_changes[node] for op in self.op_changes: print op,self.op_changes[op] + for ticket in self.ticket_changes: + print ticket,self.ticket_changes[ticket] if self.quorum: print "quorum:",self.quorum return True @@ -285,6 +294,22 @@ self.node_changes[node] = state self.modified = True return True + def edit_ticket(self,ticket,subcmd): + ''' + Modify ticket status. + ''' + if not self.get_status(): + return False + if not subcmd in self.ticket_ops: + common_err("unknown ticket command %s" % subcmd) + return False + rc = self.inject("%s %s" % (self.ticket_ops[subcmd], ticket)) + if rc != 0: + return False + self._load(self.origin) + self.ticket_changes[ticket] = subcmd + self.modified = True + return True def edit_op(self,op,rsc,rc_code,op_status,node = ''): ''' Set rc-code and op-status in the lrm_rsc_op status 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/help.py.in 2012-03-26 17:48:33.000000000 +0200 @@ -19,7 +19,7 @@ import re from cache import WCache from utils import odict, page_string -from vars import gethomedir +from vars import Vars from msg import * # @@ -109,7 +109,6 @@ [[cmdhelp_<level>,<short help text>]] ''' help_text_file = "@datadir@/@PACKAGE@/crm.8.txt" - index_file = os.path.join(gethomedir(),".crm_help_index") def __init__(self): self.key_pos = {} self.leveld = {} @@ -126,7 +125,7 @@ return None def drop_index(self): common_info("removing index") - os.unlink(self.index_file) + os.unlink(vars.index_file) self.key_pos = {} self.leveld = {} self.bad_index = True @@ -143,7 +142,7 @@ help_f = self.open_file(self.help_text_file,"r") if not help_f: return False - idx_f = self.open_file(self.index_file,"w") + idx_f = self.open_file(vars.index_file,"w") if not idx_f: return False common_debug("building help index") @@ -164,7 +163,7 @@ return True def is_index_old(self): try: - t_idx = os.path.getmtime(self.index_file) + t_idx = os.path.getmtime(vars.index_file) except: return True try: @@ -177,7 +176,7 @@ self.mk_index() self.key_pos = {} self.leveld = {} - idx_f = self.open_file(self.index_file,"r") + idx_f = self.open_file(vars.index_file,"r") if not idx_f: return False cur_lvl = '' @@ -273,5 +272,6 @@ return wcache.store("lvl_help_tab_%s" % lvl, help_tab) wcache = WCache.getInstance() +vars = Vars.getInstance() # vim:ts=4:sw=4:et: 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/main.py 2012-03-26 17:48:33.000000000 +0200 @@ -22,7 +22,7 @@ from utils import * from userprefs import Options, UserPrefs -from vars import Vars +from vars import Vars, gethomedir from ui import cmd_exit from msg import * from levels import Levels @@ -249,10 +249,49 @@ if sys.stdin.isatty(): options.interactive = True +def xdg_file(name, xdg_name, obj_type, semantics): + if not name or not xdg_name: + return name + try: + from xdg import BaseDirectory + config_home = BaseDirectory.xdg_config_home + cache_home = BaseDirectory.xdg_cache_home + except: + # see http://standards.freedesktop.org/basedir-spec + homedir = gethomedir() + config_home = os.path.join(homedir, ".config") + cache_home = os.path.join(homedir, ".cache") + chk_fun = obj_type == "f" and os.path.isfile or os.path.isdir + dir = os.path.join(semantics == "config" and \ + config_home or cache_home, "crm") + if not os.path.isdir(dir): + os.makedirs(dir, 0700) + new = os.path.join(dir, xdg_name) + if semantics == "config" and chk_fun(new) and chk_fun(name): + common_warn("both %s and %s exist, please cleanup" % (name, new)) + return name + if chk_fun(name): + if semantics == "config": + common_info("moving %s to %s" % (name, new)) + else: + common_debug("moving %s to %s" % (name, new)) + os.rename(name, new) + return new +def mv_user_files(): + vars.hist_file = xdg_file(vars.hist_file, \ + vars.xdg_map["history"], "f", "cache") + vars.rc_file = xdg_file(vars.rc_file, \ + vars.xdg_map["rc"], "f", "config") + vars.index_file = xdg_file(vars.index_file, \ + vars.xdg_map["help_index"], "f", "cache") + vars.tmpl_conf_dir = xdg_file(vars.tmpl_conf_dir, \ + vars.xdg_map["crmconf"], "d", "config") + def run(): prereqs() inp_file = '' + mv_user_files() load_rc(vars.rc_file) if not sys.stdin.isatty(): @@ -269,8 +308,7 @@ if o in ("-h","--help"): usage(0) elif o in ("--version"): - print >> sys.stdout,("""%s -""" % vars.crm_version) + print >> sys.stdout,("%s" % vars.crm_version) sys.exit(0) elif o == "-d": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh/modules/ra.py.in new/crmsh/modules/ra.py.in --- old/crmsh/modules/ra.py.in 2012-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/ra.py.in 2012-03-26 17:48:33.000000000 +0200 @@ -24,7 +24,7 @@ import glob from userprefs import Options, UserPrefs from cache import WCache -from vars import Vars, getuser +from vars import Vars, getpwdent from utils import * from msg import * @@ -37,26 +37,26 @@ if not ocf_root: ocf_root = "/usr/lib/ocf" os.putenv("OCF_ROOT",ocf_root) +lrmadmin_prog = "lrmadmin" class RaLrmd(object): ''' Getting information from the resource agents. ''' - lrmadmin_prog = "lrmadmin" def __init__(self): self.good = self.is_lrmd_accessible() def lrmadmin(self, opts, xml = False): ''' Get information directly from lrmd using lrmadmin. ''' - l = stdout2list("%s %s" % (self.lrmadmin_prog,opts)) + l = stdout2list("%s %s" % (lrmadmin_prog,opts)) if l and not xml: l = l[1:] # skip the first line return l def is_lrmd_accessible(self): - if not (is_program(self.lrmadmin_prog) and is_process("lrmd")): + if not (is_program(lrmadmin_prog) and is_process("lrmd")): return False return subprocess.call(\ - add_sudo(">/dev/null 2>&1 %s -C" % self.lrmadmin_prog), \ + add_sudo(">/dev/null 2>&1 %s -C" % lrmadmin_prog), \ shell=True) == 0 def meta(self, ra_class,ra_type,ra_provider): return self.lrmadmin("-M %s %s %s"%(ra_class,ra_type,ra_provider),True) @@ -110,10 +110,20 @@ l.sort() return l +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) + return v_this >= v_min or \ + (getpwdent()[0] in ("root",vars.crm_daemon_user)) def ra_if(): if vars.ra_if: return vars.ra_if - if getuser() in ("root",vars.crm_daemon_user): + if can_use_lrmadmin(): vars.ra_if = RaLrmd() if not vars.ra_if or not vars.ra_if.good: vars.ra_if = RaOS() 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/ui.py.in 2012-03-26 17:48:33.000000000 +0200 @@ -1308,6 +1308,7 @@ self.cmd_table["run"] = (self.run,(0,3),1,0) self.cmd_table["simulate"] = (self.simulate,(0,3),1,0) self.cmd_table["quorum"] = (self.quorum,(1,1),1,0) + self.cmd_table["ticket"] = (self.edit_ticket,(2,2),2,0) setup_aliases(self) def myname(self): '''Just return some id.''' @@ -1340,6 +1341,9 @@ def edit_node(self,cmd,node,state): "usage: node <node> {online|offline|unclean}" return cib_status.edit_node(node,state) + def edit_ticket(self,cmd,ticket,subcmd): + "usage: ticket <ticket> {grant|revoke|activate|standby}" + return cib_status.edit_ticket(ticket,subcmd) def edit_op(self,cmd,op,rsc,rc,op_status = None,node = ''): "usage: op <operation> <resource> <exit_code> [<op_status>] [<node>]" if rc in vars.lrm_exit_codes: @@ -1963,17 +1967,19 @@ Geo-cluster related management. """ crm_ticket = { - 'grant': "crm_ticket -t '%s' -v true", - 'revoke': "crm_ticket -t '%s' -v false", - 'delete': "crm_ticket -t '%s' -D", - 'show': "crm_ticket -t '%s' -G", - 'time': "crm_ticket -t '%s' -T", + 'grant': "crm_ticket -t '%s' -g", + 'revoke': "crm_ticket -t '%s' -r", + 'delete': "crm_ticket -t '%s' -D granted", + 'standby': "crm_ticket -t '%s' -s", + 'activate': "crm_ticket -t '%s' -a", + 'show': "crm_ticket -t '%s' -G granted", + 'time': "crm_ticket -t '%s' -G last-granted", } def __init__(self): UserInterface.__init__(self) self.cmd_table["ticket"] = (self.ticket,(2,2),1,0) def ticket(self, cmd, subcmd, ticket): - "usage: ticket {grant|revoke|show|time|delete} <ticket>" + "usage: ticket {grant|revoke|standby|activate|show|time|delete} <ticket>" try: attr_cmd = self.crm_ticket[subcmd] except: 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-02-03 12:13:57.000000000 +0100 +++ new/crmsh/modules/vars.py.in 2012-03-26 17:48:33.000000000 +0200 @@ -188,6 +188,13 @@ hist_file = os.path.join(homedir,".crm_history") rc_file = os.path.join(homedir,".crm.rc") tmpl_conf_dir = os.path.join(homedir,".crmconf") + index_file = os.path.join(homedir,".crm_help_index") + xdg_map = { + "history": "history", + "rc": "rc", + "crmconf": "crmconf", + "help_index": "help_index", + } report_cache = os.path.join("@CRM_CACHE_DIR@","history") tmpl_dir = "@datadir@/@PACKAGE@/templates" pe_dir = "@PE_STATE_DIR@" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
