Merge "Change exit code when displaying empty rings"

This commit is contained in:
Zuul
2018-01-11 12:16:56 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 5 deletions

View File

@@ -547,9 +547,7 @@ swift-ring-builder <builder_file>
if ring_empty_error:
print(ring_empty_error)
exit(EXIT_ERROR)
else:
exit(EXIT_SUCCESS)
exit(EXIT_SUCCESS)
@staticmethod
def search():

View File

@@ -1903,7 +1903,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
argv = ["", self.tmpfile, "default"]
with mock.patch("sys.stdout", mock_stdout):
with mock.patch("sys.stderr", mock_stderr):
self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv)
self.assertSystemExit(EXIT_SUCCESS, ringbuilder.main, argv)
deleted_dev_list = (
" 0 0 0 127.0.0.1:6200 127.0.0.1:6200 "
"sda1 0.00 0 0.00 DEL some meta data\n"
@@ -1929,7 +1929,7 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
argv = ["", self.tmpfile, "default"]
with mock.patch("sys.stdout", mock_stdout):
with mock.patch("sys.stderr", mock_stderr):
self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv)
self.assertSystemExit(EXIT_SUCCESS, ringbuilder.main, argv)
output = mock_stdout.getvalue()
self.assertIn("64 partitions", output)