]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Replace exit() by sys.exit()
authorcaoyue <yue.cao@easystack.cn>
Mon, 25 Jan 2016 09:20:07 +0000 (17:20 +0800)
committercaoyue <yue.cao@easystack.cn>
Mon, 25 Jan 2016 09:29:09 +0000 (17:29 +0800)
exit() is used for interactive shell, it relies on the site module.
sys.exit() is considered good to use in programs.

Trivial-fix

Change-Id: Ie05e4da082d6eae87c75200c78da68d9a18c19a7

cinder/cmd/manage.py

index 116e436fca6c6fd6daf10f929a3094783bf13374..5c8ab2bcb8426bd3ba520193d85aa21dece34ce4 100644 (file)
@@ -171,7 +171,7 @@ def _db_error(caught_exception):
     print(_("The above error may show that the database has not "
             "been created.\nPlease create a database using "
             "'cinder-manage db sync' before running this command."))
-    exit(1)
+    sys.exit(1)
 
 
 class HostCommands(object):
@@ -226,7 +226,7 @@ class DbCommands(object):
         age_in_days = int(age_in_days)
         if age_in_days <= 0:
             print(_("Must supply a positive, non-zero value for age"))
-            exit(1)
+            sys.exit(1)
         ctxt = context.get_admin_context()
         db.purge_deleted_rows(ctxt, age_in_days)