Skip to content

Commit

Permalink
Fix for job conf glitch
Browse files Browse the repository at this point in the history
when providing a job config file with the resource flag being omitted,
Longbow would exit ungracefully with a badly worded error message. This
boiled down to a bad dictionary key. Fixed with try/except
  • Loading branch information
jimboid committed Sep 20, 2016
1 parent dfc417c commit 5976176
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions Longbow/corelibs/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,31 @@ def processconfigs(parameters):

# If user has not indicated which resource to use or didn't use a
# job.conf then check other sources.
if jobdata[job]["resource"] is "":
try:

if jobdata[job]["resource"] is "":

# Since at this point we only have command-line as higher
# priority.
if parameters["resource"] is not "":

# Since at this point we only have command-line as higher
# priority.
if parameters["resource"] is not "":
jobs[job]["resource"] = parameters["resource"]

jobs[job]["resource"] = parameters["resource"]
# Otherwise lets try and use the top host in the list from
# host.conf. This should never be an empty list since the
# parser would provide an error on load.
else:

jobs[job]["resource"] = hostsections[0]

# Otherwise lets try and use the top host in the list from
# host.conf. This should never be an empty list since the
# parser would provide an error on load.
# Just copy it over.
else:

jobs[job]["resource"] = hostsections[0]
jobs[job]["resource"] = jobdata[job]["resource"]

# Just copy it over.
else:
except KeyError:

jobs[job]["resource"] = jobdata[job]["resource"]
jobs[job]["resource"] = hostsections[0]

# Validate that we have this host listed.
if jobs[job]["resource"] not in hostsections:
Expand Down

0 comments on commit 5976176

Please sign in to comment.