Using sys.exit(main()) instead of main()

TrivialFix: Similar [1] in Kolla project
As we known, Exceptions are raised by the sys.exit() function. When they
are not handled, no stack traceback is printed in the Python interpreter.
Therefore, when using sys.exit(main()) instead of main()
may be more readable and reasonable.

[1] https://review.openstack.org/#/c/349353/

Change-Id: Ic71d4bfb1085c68ea9eb7e1382e7263a81634ad1
This commit is contained in:
Luong Anh Tuan 2016-09-26 10:51:27 +07:00
parent acaafb4ab9
commit 1827e5434e
5 changed files with 12 additions and 5 deletions

View File

@ -247,4 +247,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View File

@ -21,6 +21,7 @@ from alembic import util as alembic_u
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import importutils from oslo_utils import importutils
import six import six
import sys
from mistral.services import action_manager from mistral.services import action_manager
from mistral.services import workflows from mistral.services import workflows
@ -129,4 +130,4 @@ def main():
CONF.command.func(config, CONF.command.name) CONF.command.func(config, CONF.command.name)
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
from mistral.engine.rpc_backend.kombu import kombu_client from mistral.engine.rpc_backend.kombu import kombu_client
@ -39,4 +41,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
from mistral.engine.rpc_backend.kombu import kombu_server from mistral.engine.rpc_backend.kombu import kombu_server
@ -48,4 +50,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import keystonemiddleware.opts as keystonemw_opts import keystonemiddleware.opts as keystonemw_opts
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
@ -49,4 +51,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() sys.exit(main())