Bug 674598 - cumin cannot handle leading spaces in variable name
Summary: cumin cannot handle leading spaces in variable name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: cumin
Version: 1.3
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: 2.0.1
: ---
Assignee: Trevor McKay
QA Contact: Jan Sarenik
URL:
Whiteboard:
Depends On:
Blocks: 723887
TreeView+ depends on / blocked
 
Reported: 2011-02-02 15:36 UTC by Martin Kudlej
Modified: 2011-09-07 16:45 UTC (History)
4 users (show)

Fixed In Version: cumin-0.1.4840-1
Doc Type: Bug Fix
Doc Text:
Cumin's configuration file parser treats a line that begins with whitespace as a continuation of the previous line. In cumin.conf, whitespace at the beginning of a line that was not a (valid) continuation of the previous line caused parsing errors which were not communicated to the user, and which could have caused the cumin service to restart the application in an endless loop. With this update, any parsing errors are caught by the init script, any exception traces are recorded in log files under the /var/log/cumin/ directory (the exact file depends on whether cumin-data or cumin-web first detected the error), and a parsing error results in the service failing upon startup (with "[FAILED]" printed to alert the user).
Clone Of:
Environment:
Last Closed: 2011-09-07 16:45:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:1249 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise MRG Grid 2.0 security, bug fix and enhancement update 2011-09-07 16:40:45 UTC

Description Martin Kudlej 2011-02-02 15:36:57 UTC
Description of problem:

# vim /etc/cumin/cumin.conf

...
[web]
# log-file: $CUMIN_HOME/log/web.log
# host: localhost ('0.0.0.0' binds to all local interfaces)
 host: 0.0.0.0
# port: 45672
# operator-email: [none]
# update-interval: 10
...

# service cumin restart
Stopping cumin:                                            [  OK  ]
Starting cumin:                                            [  OK  ]
# Traceback (most recent call last):
  File "/usr/bin/cumin-data", line 78, in ?
    main()
  File "/usr/bin/cumin-data", line 14, in main
    config, values, opts, args = get_configuration(CuminDataOptionParser(), CuminDataConfig)
  File "/usr/share/cumin/python/cumin/config.py", line 172, in get_configuration
    values = config.parse()
  File "/usr/share/cumin/python/cumin/config.py", line 30, in parse
    return self.parse_files(paths)
  File "/usr/share/cumin/python/parsley/config.py", line 13, in parse_files
    found = parser.read(paths)
  File "/usr/lib64/python2.4/ConfigParser.py", line 267, in read
    self._read(fp, filename)
  File "/usr/lib64/python2.4/ConfigParser.py", line 490, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: /etc/cumin/cumin.conf
        [line 11]: ' host: 0.0.0.0\n'
Traceback (most recent call last):
  File "/usr/bin/cumin-web", line 51, in ?
    main()
  File "/usr/bin/cumin-web", line 14, in main
    config, values, opts, args = get_configuration(CuminWebOptionParser(), CuminWebConfig)
  File "/usr/share/cumin/python/cumin/config.py", line 172, in get_configuration
    values = config.parse()
  File "/usr/share/cumin/python/cumin/config.py", line 30, in parse
    return self.parse_files(paths)
  File "/usr/share/cumin/python/parsley/config.py", line 13, in parse_files
    found = parser.read(paths)
  File "/usr/lib64/python2.4/ConfigParser.py", line 267, in read
    self._read(fp, filename)
  File "/usr/lib64/python2.4/ConfigParser.py", line 490, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: /etc/cumin/cumin.conf
        [line 11]: ' host: 0.0.0.0\n'



Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. add leading space character(s) to any variable
2. service cumin start
  
Actual results:
It raises exception again and again in infinite loop. command service end with 0.

Expected results:
If there is any exception in cumin, service will end with non zero value.
It will be able to handle variables with leading space character(s)

Comment 1 Trevor McKay 2011-05-18 20:15:18 UTC
Revision 4770.

Lines beginning with white space are an indicator of a continuation from a previous line in the Python ConfigParser class, so the parse error is actually correct from the point of view of the object we're using -- there is no preceding line that has been continued.

Continuous looping should be gone.  Furthermore, the parse error exception trace should be visible in master.log.

Comment 3 Jan Sarenik 2011-06-21 15:12:52 UTC
Verified in cumin-0.1.4840-1.el6.noarch
Message is also written to master.log

------------------------------------------------------
Traceback (most recent call last):
  File "/usr/bin/cumin-admin", line 372, in <module>
    main()
  File "/usr/bin/cumin-admin", line 37, in main
    values = config.parse()
  File "/usr/share/cumin/python/cumin/config.py", line 104, in parse
    return self.parse_files(paths)
  File "/usr/share/cumin/python/parsley/config.py", line 13, in parse_files
    found = parser.read(paths)
  File "/usr/lib64/python2.6/ConfigParser.py", line 286, in read
    self._read(fp, filename)
  File "/usr/lib64/python2.6/ConfigParser.py", line 510, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: /etc/cumin/cumin.conf
        [line 16]: '  brokers: cumin/cumin@localhost:5672\n'
        [line 17]: ' sasl-mech-list: plain\n'

Comment 4 Trevor McKay 2011-07-25 15:05:20 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    The configuration parser used by cumin treats a line beginning with white space as a continuation of the previous line.  Putting white space at the beginning of a line in cumin.conf that is not a valid continuation of the previous line may result in a parsing error.  This is expected, but previously cumin did not handle parsing errors gracefully.

Consequence
    Errors were not clearly communicated to the user and in some prior releases the cumin service would restart the application in an endless loop.

Fix
    Parsing errors are caught by the cumin master script and exception traces are recorded in log files under /var/log/cumin.

Result
    A parsing error will result in a [FAILED] result when the service is started.  Additionally, the exception trace produced by the parser will be recorded in a log file under /var/log/cumin (the file will depend on which cumin-data or cumin-web instance first detected the error).

Comment 5 Douglas Silas 2011-08-09 14:15:15 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,11 +1 @@
-Cause
+Cumin's configuration file parser treats a line that begins with whitespace as a continuation of the previous line. In cumin.conf, whitespace at the beginning of a line that was not a (valid) continuation of the previous line caused parsing errors which were not communicated to the user, and which could have caused the cumin service to restart the application in an endless loop. With this update, any parsing errors are caught by the init script, any exception traces are recorded in log files under the /var/log/cumin/ directory (the exact file depends on whether cumin-data or cumin-web first detected the error), and a parsing error results in the service failing upon startup (with "[FAILED]" printed to alert the user).-    The configuration parser used by cumin treats a line beginning with white space as a continuation of the previous line.  Putting white space at the beginning of a line in cumin.conf that is not a valid continuation of the previous line may result in a parsing error.  This is expected, but previously cumin did not handle parsing errors gracefully.
-
-Consequence
-    Errors were not clearly communicated to the user and in some prior releases the cumin service would restart the application in an endless loop.
-
-Fix
-    Parsing errors are caught by the cumin master script and exception traces are recorded in log files under /var/log/cumin.
-
-Result
-    A parsing error will result in a [FAILED] result when the service is started.  Additionally, the exception trace produced by the parser will be recorded in a log file under /var/log/cumin (the file will depend on which cumin-data or cumin-web instance first detected the error).

Comment 6 errata-xmlrpc 2011-09-07 16:45:21 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-1249.html


Note You need to log in before you can comment on or make changes to this bug.