Modify

Ticket #493 (closed defect: fixed)

Opened 16 years ago

Last modified 9 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 (818 bytes) - added by labrown 16 years ago.
Patch to catch this traceback, based on svn HEAD

Change History

Changed 16 years ago by labrown

Patch to catch this traceback, based on svn HEAD

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 ;)

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.