Propagate return code
Previously the results were only being printed, but the return code for the checks wasn't propagated up.
This commit is contained in:
parent
8d76949735
commit
d3877b9087
@ -14,6 +14,8 @@
|
||||
|
||||
"""Example CLI command for running upgrade checks"""
|
||||
|
||||
import sys
|
||||
|
||||
from oslo_upgradecheck import upgradecheck
|
||||
|
||||
|
||||
@ -33,8 +35,8 @@ class Checks(upgradecheck.UpgradeCommands):
|
||||
|
||||
def main():
|
||||
inst = Checks()
|
||||
upgradecheck.main(inst.check)
|
||||
return upgradecheck.main(inst.check)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(main())
|
||||
|
@ -77,4 +77,5 @@ class TestMain(base.BaseTestCase):
|
||||
mock_argv = ['test-status', 'upgrade', 'check']
|
||||
with mock.patch.object(sys, 'argv', mock_argv, create=True):
|
||||
inst = TestCommands()
|
||||
upgradecheck.main(inst.check)
|
||||
result = upgradecheck.main(inst.check)
|
||||
self.assertEqual(upgradecheck.UpgradeCheckCode.FAILURE, result)
|
||||
|
@ -148,4 +148,4 @@ def main(check_callback):
|
||||
conf.register_cli_opt(opt)
|
||||
conf(sys.argv[1:])
|
||||
|
||||
conf.category.action_fn()
|
||||
return conf.category.action_fn()
|
||||
|
Loading…
x
Reference in New Issue
Block a user