Merge "kolla-build --list-dependencies use json, not pprint"
This commit is contained in:
commit
49e45698da
|
@ -20,7 +20,6 @@ import errno
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pprint
|
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -1025,7 +1024,7 @@ class KollaWorker(object):
|
||||||
|
|
||||||
ancestry = {base.name: []}
|
ancestry = {base.name: []}
|
||||||
list_children(base.children, ancestry)
|
list_children(base.children, ancestry)
|
||||||
pprint.pprint(ancestry)
|
json.dump(ancestry, sys.stdout, indent=2)
|
||||||
|
|
||||||
def find_parents(self):
|
def find_parents(self):
|
||||||
"""Associate all images with parents and children."""
|
"""Associate all images with parents and children."""
|
||||||
|
|
|
@ -15,6 +15,7 @@ import itertools
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
from kolla.cmd import build as build_cmd
|
from kolla.cmd import build as build_cmd
|
||||||
from kolla import exception
|
from kolla import exception
|
||||||
|
@ -352,14 +353,14 @@ class KollaWorkerTest(base.TestCase):
|
||||||
self.assertRaises(ValueError,
|
self.assertRaises(ValueError,
|
||||||
kolla.filter_images)
|
kolla.filter_images)
|
||||||
|
|
||||||
@mock.patch('pprint.pprint')
|
@mock.patch('json.dump')
|
||||||
def test_list_dependencies(self, pprint_mock):
|
def test_list_dependencies(self, dump_mock):
|
||||||
self.conf.set_override('profile', ['all'])
|
self.conf.set_override('profile', ['all'])
|
||||||
kolla = build.KollaWorker(self.conf)
|
kolla = build.KollaWorker(self.conf)
|
||||||
kolla.images = self.images
|
kolla.images = self.images
|
||||||
kolla.filter_images()
|
kolla.filter_images()
|
||||||
kolla.list_dependencies()
|
kolla.list_dependencies()
|
||||||
pprint_mock.assert_called_once_with(mock.ANY)
|
dump_mock.assert_called_once_with(mock.ANY, sys.stdout, indent=2)
|
||||||
|
|
||||||
def test_summary(self):
|
def test_summary(self):
|
||||||
kolla = build.KollaWorker(self.conf)
|
kolla = build.KollaWorker(self.conf)
|
||||||
|
|
Loading…
Reference in New Issue