Change usage of exit() to sys.exit()
sys.exit() is the correct way to terminate. It is recommended to not use exit() in programs[1]: The site module (which is imported automatically during startup, except if the -S command-line option is given) adds several constants to the built-in namespace. They are useful for the interactive interpreter shell and should not be used in programs. [1] https://docs.python.org/3/library/constants.html#exit Change-Id: I4bfeba2f351c51a4da2e283ee44e10b76f863ff6
This commit is contained in:
parent
c92a915cf8
commit
a9d6de3ed5
|
@ -17,6 +17,7 @@ import collections
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
try:
|
try:
|
||||||
import ordereddict
|
import ordereddict
|
||||||
except:
|
except:
|
||||||
|
@ -137,7 +138,7 @@ class Config(object):
|
||||||
|
|
||||||
if not os.path.exists(self.path):
|
if not os.path.exists(self.path):
|
||||||
self.printSample()
|
self.printSample()
|
||||||
exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
self.config = yaml.load(open(self.path))
|
self.config = yaml.load(open(self.path))
|
||||||
schema = ConfigSchema().getSchema(self.config)
|
schema = ConfigSchema().getSchema(self.config)
|
||||||
|
@ -164,7 +165,7 @@ class Config(object):
|
||||||
"Error: Config file '{}' contains a password and does "
|
"Error: Config file '{}' contains a password and does "
|
||||||
"not have permissions set to 0600.\n"
|
"not have permissions set to 0600.\n"
|
||||||
"Permissions are: {}".format(self.path, oct(mode)))
|
"Permissions are: {}".format(self.path, oct(mode)))
|
||||||
exit(1)
|
sys.exit(1)
|
||||||
self.auth_type = server.get('auth-type', 'digest')
|
self.auth_type = server.get('auth-type', 'digest')
|
||||||
self.verify_ssl = server.get('verify-ssl', True)
|
self.verify_ssl = server.get('verify-ssl', True)
|
||||||
if not self.verify_ssl:
|
if not self.verify_ssl:
|
||||||
|
|
Loading…
Reference in New Issue