nova-status: return 255 for unexpected errors

This came up during review of I687dd7317703a1bb76c197ebba849ca368c0872e.

Change-Id: I2dd62e994957d4cc8cc4a8b23a604b03815f2639
This commit is contained in:
Matt Riedemann 2016-12-22 15:56:33 -05:00
parent 3d45ab2045
commit 7a69da4b4f
3 changed files with 12 additions and 10 deletions

View File

@ -61,14 +61,16 @@ Upgrade
service catalog.
**Return Codes**
::
0) All upgrade readiness checks passed successfully and there is nothing
to do.
1) At least one check encountered an issue and requires further
investigation. This is considered a warning but the upgrade may be OK.
2) There was an upgrade status check failure that needs to be
investigated. This should be considered something that stops an
upgrade.
0) All upgrade readiness checks passed successfully and there is nothing
to do.
1) At least one check encountered an issue and requires further
investigation. This is considered a warning but the upgrade may be OK.
2) There was an upgrade status check failure that needs to be
investigated. This should be considered something that stops an
upgrade.
255) An unexpected error occurred.
**History of Checks**

View File

@ -205,5 +205,5 @@ def main():
return(ret)
except Exception:
print(_('Error:\n%s') % traceback.format_exc())
# This is 10 so it's not confused with the upgrade check exit codes.
return 10
# This is 255 so it's not confused with the upgrade check exit codes.
return 255

View File

@ -74,7 +74,7 @@ class TestNovaStatusMain(test.NoDBTestCase):
mock_fn = mock.Mock(side_effect=Exception('wut'))
mock_get_action_fn.return_value = (mock_fn, [], {})
self._check_main(expected_return_value=10)
self._check_main(expected_return_value=255)
output = self.output.getvalue()
self.assertIn('Error:', output)
# assert the traceback is in the output