Add a conditional judgement to avoid invalid dict index

Before index the job_configs by key 'args', we add a judgement
to see whether key 'args' exists.

Closes-Bug: #1456171
Change-Id: I42fa4bfe5d2b9a90833bae25bd9ac44c614fd9ce
This commit is contained in:
Ken Chen 2015-05-18 19:58:27 +08:00
parent bbd0f2f8f2
commit 7fe5c80143

View File

@ -187,8 +187,10 @@ class JobConfigAction(workflows.Action):
if 'params' in job_configs: if 'params' in job_configs:
self.fields['job_params'].initial = ( self.fields['job_params'].initial = (
json.dumps(job_configs['params'])) json.dumps(job_configs['params']))
job_args = json.dumps(job_configs['args'])
self.fields['job_args_array'].initial = job_args if 'args' in job_configs:
self.fields['job_args_array'].initial = (
json.dumps(job_configs['args']))
if self.MAIN_CLASS in edp_configs: if self.MAIN_CLASS in edp_configs:
self.fields['main_class'].initial = ( self.fields['main_class'].initial = (