Ticket #493 (closed defect: fixed)
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
Change History
Changed 16 years ago by labrown
- Attachment bcfg2.conf-parser-patch.patch added
comment:1 Changed 15 years ago by desai
- Status changed from new to closed
- Resolution set to fixed
I committed a slightly different patch in revision [d0cd2ba44a52ef3c458fa80544692d930f9d5341] (SVN r4018). 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 ;)
Patch to catch this traceback, based on svn HEAD