Fix kolla-build return codes
Add a main wrapper function to return 1 if any images failed to build; otherwise, return 0. Rename the old main() to run_build(), which still returns image statuses, to avoid interfering with unit tests. Change-Id: I5817cc9cebb4f42dc13e0535223e5dc8931a3aab Co-Authored-By: Mark Goddard <mgoddard@cray.com> Closes-Bug: #1578404
This commit is contained in:
parent
c51e315523
commit
18ae114e75
@ -737,7 +737,7 @@ class KollaWorker(object):
|
|||||||
return queue
|
return queue
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def run_build():
|
||||||
conf = cfg.ConfigOpts()
|
conf = cfg.ConfigOpts()
|
||||||
common_config.parse(conf, sys.argv[1:], prog='kolla-build')
|
common_config.parse(conf, sys.argv[1:], prog='kolla-build')
|
||||||
|
|
||||||
@ -791,5 +791,13 @@ def main():
|
|||||||
return kolla.get_image_statuses()
|
return kolla.get_image_statuses()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
bad_results, good_results, unmatched_results = run_build()
|
||||||
|
if len(bad_results):
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -43,7 +43,7 @@ class BuildTest(object):
|
|||||||
def runTest(self):
|
def runTest(self):
|
||||||
with patch.object(sys, 'argv', self.build_args):
|
with patch.object(sys, 'argv', self.build_args):
|
||||||
LOG.info("Running with args %s", self.build_args)
|
LOG.info("Running with args %s", self.build_args)
|
||||||
bad_results, good_results, unmatched_results = build.main()
|
bad_results, good_results, unmatched_results = build.run_build()
|
||||||
|
|
||||||
failures = 0
|
failures = 0
|
||||||
for image, result in six.iteritems(bad_results):
|
for image, result in six.iteritems(bad_results):
|
||||||
|
Loading…
Reference in New Issue
Block a user