Hello community,

here is the log from the commit of package crmsh for openSUSE:Factory checked 
in at 2014-05-02 13:54:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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      2014-04-20 
11:36:52.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.crmsh.new/crmsh.changes 2014-05-02 
13:54:47.000000000 +0200
@@ -1,0 +2,12 @@
+Wed Apr 30 09:10:19 UTC 2014 - kgronl...@suse.com
+
+- ui: Fix garbage characters in prompt (bnc#875788)
+- report: Resolve datetime/timestamp mixup (bnc#874162)
+- parse: Fix check for action/role in resource set parser (bnc#875787)
+- site: pass --force flag through to crm_ticket (bnc#873200)
+- cibconf: add comments in the right order (bnc#866434)
+- parse: Unify API for err() (bnc#875791)
+- crm: Check and complain about python version < 2.6
+- upstream: 2.0.0-38-gc2e94fe366a3 
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ crmsh.spec ++++++
--- /var/tmp/diff_new_pack.GxHnEl/_old  2014-05-02 13:54:48.000000000 +0200
+++ /var/tmp/diff_new_pack.GxHnEl/_new  2014-05-02 13:54:48.000000000 +0200
@@ -41,7 +41,7 @@
 Summary:        High Availability cluster command-line interface
 License:        GPL-2.0+
 Group:          %{pkg_group}
-Version:        2.0+git18
+Version:        2.0+git38
 Release:        %{?crmsh_release}%{?dist}
 Url:            http://crmsh.github.io
 Source0:        crmsh.tar.bz2

++++++ crmsh.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/crm new/crmsh/crm
--- old/crmsh/crm       2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/crm       2014-04-30 10:46:19.000000000 +0200
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 
-minimum_version = '2.4'
+minimum_version = '2.6'
 import sys
 
 from distutils import version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/modules/clidisplay.py 
new/crmsh/modules/clidisplay.py
--- old/crmsh/modules/clidisplay.py     2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/clidisplay.py     2014-04-30 10:46:19.000000000 +0200
@@ -65,6 +65,11 @@
             return s + "${RLIGNOREBEGIN}${NORMAL}${RLIGNOREEND}"
         return s
 
+    def prompt_noreadline(self, s):
+        if self.colors_enabled():
+            return "${GREEN}${BOLD}" + s + "${NORMAL}"
+        return s
+
     def help_header(self, s):
         return self._colorize(s, config.color.help_header)
 
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   2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/main.py   2014-04-30 10:46:19.000000000 +0200
@@ -291,17 +291,19 @@
     rc = 0
     while True:
         try:
+            rendered_prompt = vars.prompt
             if options.interactive and not options.batch:
                 # TODO: fix how color interacts with readline,
                 # seems the color prompt messes it up
                 termctrl = TerminalController.getInstance()
                 cli_display = CliDisplay.getInstance()
                 promptstr = "crm(%s)%s# " % (cib_prompt(), context.prompt())
+                vars.prompt = promptstr
                 if cli_display.colors_enabled():
-                    vars.prompt = 
termctrl.render(cli_display.prompt(promptstr))
+                    rendered_prompt = 
termctrl.render(cli_display.prompt(promptstr))
                 else:
-                    vars.prompt = promptstr
-            inp = utils.multi_input(vars.prompt)
+                    rendered_prompt = promptstr
+            inp = utils.multi_input(rendered_prompt)
             if inp is None:
                 if options.interactive:
                     rc = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/modules/parse.py new/crmsh/modules/parse.py
--- old/crmsh/modules/parse.py  2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/parse.py  2014-04-30 10:46:19.000000000 +0200
@@ -977,8 +977,7 @@
 
     def __init__(self, type, s, parent):
         self.parent = parent
-        self.type = type
-        self.q_attr = (type == "order") and "action" or "role"
+        self.q_attr = type
         self.tokens = s
         self.cli_list = []
         self.reset_set()
@@ -1046,9 +1045,9 @@
             l = [p, '']
         return l
 
-    def err(self, token, errmsg):
+    def err(self, errmsg, token=''):
         syntax_err(self.parent._cmd,
-                   context=self.type,
+                   context=self.q_attr,
                    token=token,
                    msg=errmsg)
         raise ParseError
@@ -1056,19 +1055,19 @@
     def update_attrs(self, bracket, tokpos):
         if bracket in ('(', '['):
             if self.opened:
-                self.err(token=self.tokens[tokpos],
-                         errmsg='Cannot nest resource sets')
+                self.err('Cannot nest resource sets',
+                         token=self.tokens[tokpos])
             self.sequential = False
             if bracket == '[':
                 self.require_all = False
             self.opened = bracket
         elif bracket in (')', ']'):
             if not self.opened:
-                self.err(token=self.tokens[tokpos],
-                         errmsg='Unmatched closing bracket')
+                self.err('Unmatched closing bracket',
+                         token=self.tokens[tokpos])
             if bracket != self.matching[self.opened]:
-                self.err(token=self.tokens[tokpos],
-                         errmsg='Mismatched closing bracket')
+                self.err('Mismatched closing bracket',
+                         token=self.tokens[tokpos])
             self.sequential = True
             self.require_all = True
             self.opened = ''
@@ -1086,15 +1085,15 @@
             if p in self.close_set:
                 # empty sets not allowed
                 if not self.set_pl:
-                    self.err(token=self.tokens[tokpos],
-                             errmsg='Empty resource set')
+                    self.err('Empty resource set',
+                             token=self.tokens[tokpos])
                 self.save_set()
                 self.update_attrs(p, tokpos)
                 continue
             if '=' in p:
                 if not self.parseattr(p):
-                    self.err(token=self.tokens[tokpos],
-                             errmsg='Unknown attribute')
+                    self.err('Unknown attribute',
+                             token=self.tokens[tokpos])
                 continue
             rsc, q = self.splitrsc(p)
             if q != self.prev_q:  # one set can't have different roles/actions
@@ -1107,8 +1106,8 @@
                 self.curr_attr = ''
             self.set_pl.append(["resource_ref", ["id", rsc]])
         if self.opened:  # no close
-            self.err(token=self.tokens[tokpos],
-                     errmsg='Unmatched opening bracket')
+            self.err('Unmatched opening bracket',
+                     token=self.tokens[tokpos])
         if self.set_pl:  # save the final set
             self.save_set()
         ret = self.cli_list
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 2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/report.py 2014-04-30 10:46:19.000000000 +0200
@@ -64,18 +64,33 @@
 
 
 def set_year(ts=None):
+    '''
+    ts: optional time in seconds
+    '''
     global YEAR
     YEAR = time.strftime("%Y", time.localtime(ts))
     common_debug("setting year to %s (ts: %s)" % (YEAR, str(ts)))
 
 
+def make_datetime(t):
+    '''
+    t: time in seconds / datetime / other
+    returns: datetime object
+    '''
+    if t is None:
+        return None
+    elif isinstance(t, datetime.datetime):
+        return t
+    return datetime.datetime.fromtimestamp(t)
+
+
 def syslog_ts(s):
     try:
         # strptime defaults year to 1900 (sigh)
         # strptime returns a time_struct
         tm = time.strptime(' '.join([YEAR] + s.split()[0:3]),
                            "%Y %b %d %H:%M:%S")
-        return datetime.datetime.fromtimestamp(time.mktime(tm))
+        return make_datetime(time.mktime(tm))
     except:  # try the rfc5424
         try:
             return parse_time(s.split()[0])
@@ -141,7 +156,7 @@
     badline = 0
     maxbadline = 10
     common_debug("seek %s:%s in %s" %
-                 (time.ctime(ts),
+                 (ts,
                   to_end and "end" or "start",
                   f.name))
     while first <= last:
@@ -291,12 +306,8 @@
         find out start/end file positions. Logs need to be
         already open.
         '''
-        if isinstance(from_dt, datetime.datetime):
-            self.from_ts = convert_dt(from_dt)
-            self.to_ts = convert_dt(to_dt)
-        else:
-            self.from_ts = from_dt
-            self.to_ts = to_dt
+        self.from_ts = make_datetime(from_dt)
+        self.to_ts = make_datetime(to_dt)
         bad_logs = []
         for log in self.f:
             f = self.f[log]
@@ -385,7 +396,7 @@
             l.append(top_line[first])
             top_line[first] = self.get_match_line(fl[first], patt)[0]
             if not top_line[first]:
-                top_line_ts[first] = time.time()
+                top_line_ts[first] = datetime.datetime.now()
             else:
                 top_line_ts[first] = syslog_ts(top_line[first])
         return l
@@ -532,7 +543,7 @@
         else:
             common_warn("end of transition %s not found in logs (transition 
not complete yet?)" %
                         self)
-            self.end_ts = time.time()
+            self.end_ts = datetime.datetime.now()
 
     def actions_count(self):
         if self.run_msg:
@@ -1290,7 +1301,7 @@
                 myts = min([syslog_ts(x) for x in first_log_lines(self.log_l)])
             elif whence == "bottom":
                 myts = max([syslog_ts(x) for x in last_log_lines(self.log_l)])
-            return datetime.datetime.fromtimestamp(myts)
+            return myts
         except:
             return None
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/modules/ui_configure.py 
new/crmsh/modules/ui_configure.py
--- old/crmsh/modules/ui_configure.py   2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/ui_configure.py   2014-04-30 10:46:19.000000000 +0200
@@ -26,6 +26,8 @@
 import xmlutil
 import ra
 from cibconfig import mkset_obj, CibFactory
+from clidisplay import CliDisplay
+from term import TerminalController
 import options
 from msg import ErrorBuffer
 from msg import common_err, common_info, common_warn
@@ -143,7 +145,13 @@
             import readline
             cmdline = readline.get_line_buffer()
             print "\n%s" % helptxt
-            print "%s%s" % (vars.prompt, cmdline),
+            cli_display = CliDisplay.getInstance()
+            if cli_display.colors_enabled():
+                termctrl = TerminalController.getInstance()
+                print "%s%s" % 
(termctrl.render(cli_display.prompt_noreadline(vars.prompt)),
+                                cmdline),
+            else:
+                print "%s%s" % (vars.prompt, cmdline),
             cls.laststamp = time.time()
             cls.lasttopic = topic
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/modules/ui_site.py new/crmsh/modules/ui_site.py
--- old/crmsh/modules/ui_site.py        2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/ui_site.py        2014-04-30 10:46:19.000000000 +0200
@@ -19,17 +19,18 @@
 import time
 import command
 import completers as compl
+import config
 import utils
 from msg import no_prog_err
 
 _ticket_commands = {
-    '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",
+    'grant': "%s -t '%s' -g",
+    'revoke': "%s -t '%s' -r",
+    'delete': "%s -t '%s' -D granted",
+    'standby': "%s -t '%s' -s",
+    'activate': "%s -t '%s' -a",
+    'show': "%s -t '%s' -G granted",
+    'time': "%s -t '%s' -G last-granted",
 }
 
 
@@ -68,14 +69,19 @@
     @command.completers(compl.choice(_ticket_commands.keys()))
     def do_ticket(self, context, subcmd, ticket):
         "usage: ticket {grant|revoke|standby|activate|show|time|delete} 
<ticket>"
+
+        base_cmd = "crm_ticket"
+        if config.core.force:
+            base_cmd += " --force"
+
         attr_cmd = _ticket_commands.get(subcmd)
         if not attr_cmd:
             context.fatal_error('Expected one of %s' % 
'|'.join(_ticket_commands.keys()))
         if not utils.is_name_sane(ticket):
             return False
         if subcmd not in ("show", "time"):
-            return utils.ext_cmd(attr_cmd % ticket) == 0
-        rc, l = utils.stdout2list(attr_cmd % ticket)
+            return utils.ext_cmd(attr_cmd % (base_cmd, ticket)) == 0
+        rc, l = utils.stdout2list(attr_cmd % (base_cmd, ticket))
         try:
             val = l[0]
         except IndexError:
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  2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/utils.py  2014-04-30 10:46:19.000000000 +0200
@@ -22,6 +22,7 @@
 import re
 import glob
 import time
+import datetime
 import shutil
 import bz2
 import config
@@ -746,10 +747,14 @@
 
 
 def shorttime(ts):
+    if isinstance(ts, datetime.datetime):
+        return ts.strftime("%X")
     return time.strftime("%X", time.localtime(ts))
 
 
 def shortdate(ts):
+    if isinstance(ts, datetime.datetime):
+        return ts.strftime("%F")
     return time.strftime("%F", time.localtime(ts))
 
 
@@ -1012,7 +1017,6 @@
         common_err("%s: %s" % (t, msg))
         return None
     except ImportError, msg:
-        import datetime
         try:
             tm = time.strptime(t)
             dt = datetime.datetime(*tm[0:7])
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        2014-04-11 09:31:00.000000000 +0200
+++ new/crmsh/modules/xmlutil.py        2014-04-30 10:46:19.000000000 +0200
@@ -706,7 +706,9 @@
 
 
 def stuff_comments(node, comments):
-    for s in comments:
+    if not comments:
+        return
+    for s in reversed(comments):
         add_comment(node, s)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/crmsh/test/unittests/test_parse.py 
new/crmsh/test/unittests/test_parse.py
--- old/crmsh/test/unittests/test_parse.py      2014-04-11 09:31:00.000000000 
+0200
+++ new/crmsh/test/unittests/test_parse.py      2014-04-30 10:46:19.000000000 
+0200
@@ -216,6 +216,9 @@
         self.assertEqual(out.resource, 'thing')
         self.assertEqual(out.score, None)
 
+        out = self.parser.parse('location l { a:foo b:bar }')
+        self.assertFalse(out)
+
     def test_colocation(self):
         out = self.parser.parse('colocation col-1 inf: foo:master ( bar wiz 
sequential=yes )')
         self.assertEqual(out.id, 'col-1')
@@ -270,6 +273,9 @@
         out = self.parser.parse('order c_apache_1 Mandatory: apache:start 
ip_1')
         self.assertEqual(out.id, 'c_apache_1')
 
+        out = self.parser.parse('order c_apache_2 Mandatory: apache:start ip_1 
ip_2 ip_3')
+        self.assertEqual(out.id, 'c_apache_2')
+
         out = self.parser.parse('order o1 Serialize: A ( B C )')
         self.assertEqual(out.id, 'o1')
 

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to