Ticket #493 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

bcfg2 client tracebacks on malformed /etc/bcfg2.conf

Reported by: labrown Owned by: desai
Priority: major Milestone:
Component: bcfg2-client Version: 0.9.x
Keywords: traceback Cc:

Description

The bcfg2 client tracebacks on a malformed /etc/bcfg2.conf file:

monstar:brown /etc $ cat /etc/bcfg2.conf daf

monstar:brown /etc $ sudo /usr/sbin/bcfg2 -q -v -I Traceback (most recent call last):

File "/usr/sbin/bcfg2", line 378, in ?

client = Client()

File "/usr/sbin/bcfg2", line 99, in init

self.setup = optparser.parse()

File "/usr/lib/python2.4/site-packages/Bcfg2/Options.py", line 57, in parse

cf.read(self.configfile)

File "/usr/lib64/python2.4/ConfigParser.py", line 267, in read

self._read(fp, filename)

File "/usr/lib64/python2.4/ConfigParser.py", line 462, in _read

raise MissingSectionHeaderError?(fpname, lineno, line)

ConfigParser?.MissingSectionHeaderError?: File contains no section headers. file: /etc/bcfg2.conf, line: 1 'daf\n' monstar:brown /etc $

Attachments

bcfg2.conf-parser-patch.patch (0.8 KB) - added by labrown 2 years ago.
Patch to catch this traceback, based on svn HEAD

Change History

Changed 2 years ago by labrown

Patch to catch this traceback, based on svn HEAD

Changed 2 years ago by desai

  • status changed from new to closed
  • resolution set to fixed

I committed a slightly different patch in revision [4018]. The differences are:

  • it doesn't print the help message (since that won't help with a config file parsing problem)
  • do a blanket except (instead of the specific one) since ConfigParser?.read can throw a bunch of different exceptions.

But overall, this is a good first python/first patch effort ;)

Add/Change #493 (bcfg2 client tracebacks on malformed /etc/bcfg2.conf)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.