diff --git a/nailgun/nailgun/api/v1/handlers/deployment_history.py b/nailgun/nailgun/api/v1/handlers/deployment_history.py index 4ad0526ed6..1fe5bb6fbf 100644 --- a/nailgun/nailgun/api/v1/handlers/deployment_history.py +++ b/nailgun/nailgun/api/v1/handlers/deployment_history.py @@ -77,15 +77,17 @@ class DeploymentHistoryCollectionHandler(base.CollectionHandler): return data def get_csv(self, data): - keys = ['task_name', 'node_id', 'status', 'time_start', 'time_end'] + keys = ['task_name', + 'node_id', + 'status', + 'type', + 'time_start', + 'time_end'] res = StringIO() csv_writer = csv.writer(res) csv_writer.writerow(keys) for obj in data: - values = [] - for k in keys: - values.append(obj.get(k)) - csv_writer.writerow(values) + csv_writer.writerow([obj.get(k) for k in keys]) return res.getvalue() diff --git a/nailgun/nailgun/test/integration/test_deployment_history_handlers.py b/nailgun/nailgun/test/integration/test_deployment_history_handlers.py index 575dae389e..224bcea551 100644 --- a/nailgun/nailgun/test/integration/test_deployment_history_handlers.py +++ b/nailgun/nailgun/test/integration/test_deployment_history_handlers.py @@ -300,6 +300,11 @@ class TestDeploymentHistoryHandlers(BaseIntegrationTest): self.assertItemsEqual( rows, - [['task_name', 'node_id', 'status', 'time_start', 'time_end'], - ['test2', cluster.nodes[0].uid, 'pending', '', ''], - ['test1', cluster.nodes[0].uid, 'pending', '', '']]) + [['task_name', + 'node_id', + 'status', + 'type', + 'time_start', + 'time_end'], + ['test2', cluster.nodes[0].uid, 'pending', 'puppet', '', ''], + ['test1', cluster.nodes[0].uid, 'pending', 'puppet', '', '']])