launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #01111
Re: how to run close_bugs_from_commits.py
I wrote:
> Edwin Grubbs <edwin.grubbs@xxxxxxxxxxxxx> writes:
>> I finally figured out what the problem was. It was failing on the
>> second project name in the config file because I had a space after the
>> commas. Ahhhhhhhhhh!!! This was confusing, since it wasn't returning
>> None or raising a KeyError. Instead, it was returning an Entry object
>> whose lp_attributes even showed "self_link", even though this
>> attribute didn't actually exist for it.
>>
>> [Project]
>> name = launchpad-registry, blueprint, launchpad-foundations
>
> [deep thought] It would be nice if any error encountered while reading
> the config file would mention that, you know, the error happened while
> reading the config file!
Sheesh, I could at least *attempt* the patch before going to bed:
[[[
When contrib/close_bugs_from_commits.py errors while parsing the config
file, make it say so, so the user doesn't think anything worse happened.
]]]
--- contrib/close_bugs_from_commits.py 2009-09-11 15:35:18 +0000
+++ contrib/close_bugs_from_commits.py 2009-09-28 22:02:31 +0000
@@ -46,16 +46,20 @@
def get_config(config_filepath):
- config_parser = RawConfigParser()
- config_parser.read([config_filepath])
- branches = dict(
- (name, dict(location=location))
- for name, location in config_parser.items('Branch Locations'))
- for name in branches:
- branches[name]['last_revno'] = config_parser.getint(
- 'Branch States', name)
- projects = config_parser.get('Project', 'name').split(',')
- return branches, projects
+ try:
+ config_parser = RawConfigParser()
+ config_parser.read([config_filepath])
+ branches = dict(
+ (name, dict(location=location))
+ for name, location in config_parser.items('Branch Locations'))
+ for name in branches:
+ branches[name]['last_revno'] = config_parser.getint(
+ 'Branch States', name)
+ projects = config_parser.get('Project', 'name').split(',')
+ return branches, projects
+ except Exception as e:
+ sys.stderr.write("Error while parsing config file:\n\n")
+ raise e
def set_last_revno(config_filepath, branch_name, revno):