Save task's title and description

Task format v2 allows to specify task title and description. It should
be saved in the database, but was not.

This patch moves initialization of TaskConfig before creating task
object. If config is totally invalid, it is not a task and there is no
reason to store trace in the db.

Change-Id: I3be9c21ca634a92fc85685f4f7b333cb79636f6d
This commit is contained in:
Andrey Kurilin 2017-09-14 18:16:17 +03:00
parent dc98fa69c8
commit 7aa7d1e0b5
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ class TaskSampleTestCase(test.TestCase):
except Exception:
print(traceback.format_exc())
self.fail("Invalid JSON file: %s" % path)
eng = engine.TaskEngine(task_config,
eng = engine.TaskEngine(engine.TaskConfig(task_config),
mock.MagicMock(), mock.Mock())
eng.validate(only_syntax=True)
except Exception:

View File

@ -78,7 +78,7 @@ class RallyJobsTestCase(test.TestCase):
task_inst = api._Task(api.API(skip_db_check=True))
task = task_inst.render_template(
task_template=task_file.read(), **args)
task = yaml.safe_load(task)
task = engine.TaskConfig(yaml.safe_load(task))
task_obj = fakes.FakeTask({"uuid": full_path})
eng = engine.TaskEngine(task, task_obj, mock.Mock())