summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-16 10:04:32 +0000
committerGerrit Code Review <review@openstack.org>2017-06-16 10:04:32 +0000
commit49e45698da71cbea87ede2f2f053fa1e8e9e2817 (patch)
tree23808bcea7448649bda22e096da8b402742a639c
parent2e5be969e5139a3e6b9f3e558a2616aa3e816ae7 (diff)
parent6131fd71b5f58a99ab4a1d85b42143699acd83b5 (diff)
Merge "kolla-build --list-dependencies use json, not pprint"
-rwxr-xr-xkolla/image/build.py3
-rw-r--r--kolla/tests/test_build.py7
2 files changed, 5 insertions, 5 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 8cff137..28e3afe 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -20,7 +20,6 @@ import errno
20import json 20import json
21import logging 21import logging
22import os 22import os
23import pprint
24import re 23import re
25import requests 24import requests
26import shutil 25import shutil
@@ -1025,7 +1024,7 @@ class KollaWorker(object):
1025 1024
1026 ancestry = {base.name: []} 1025 ancestry = {base.name: []}
1027 list_children(base.children, ancestry) 1026 list_children(base.children, ancestry)
1028 pprint.pprint(ancestry) 1027 json.dump(ancestry, sys.stdout, indent=2)
1029 1028
1030 def find_parents(self): 1029 def find_parents(self):
1031 """Associate all images with parents and children.""" 1030 """Associate all images with parents and children."""
diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py
index 0591fc1..0c50db9 100644
--- a/kolla/tests/test_build.py
+++ b/kolla/tests/test_build.py
@@ -15,6 +15,7 @@ import itertools
15import mock 15import mock
16import os 16import os
17import requests 17import requests
18import sys
18 19
19from kolla.cmd import build as build_cmd 20from kolla.cmd import build as build_cmd
20from kolla import exception 21from kolla import exception
@@ -352,14 +353,14 @@ class KollaWorkerTest(base.TestCase):
352 self.assertRaises(ValueError, 353 self.assertRaises(ValueError,
353 kolla.filter_images) 354 kolla.filter_images)
354 355
355 @mock.patch('pprint.pprint') 356 @mock.patch('json.dump')
356 def test_list_dependencies(self, pprint_mock): 357 def test_list_dependencies(self, dump_mock):
357 self.conf.set_override('profile', ['all']) 358 self.conf.set_override('profile', ['all'])
358 kolla = build.KollaWorker(self.conf) 359 kolla = build.KollaWorker(self.conf)
359 kolla.images = self.images 360 kolla.images = self.images
360 kolla.filter_images() 361 kolla.filter_images()
361 kolla.list_dependencies() 362 kolla.list_dependencies()
362 pprint_mock.assert_called_once_with(mock.ANY) 363 dump_mock.assert_called_once_with(mock.ANY, sys.stdout, indent=2)
363 364
364 def test_summary(self): 365 def test_summary(self):
365 kolla = build.KollaWorker(self.conf) 366 kolla = build.KollaWorker(self.conf)