Change exit codes, list exit codes in a doc
This commit is contained in:
parent
8ee11507c9
commit
1960efbbec
5
doc/source/exitcodes.rst
Normal file
5
doc/source/exitcodes.rst
Normal file
@ -0,0 +1,5 @@
|
||||
==========
|
||||
Exit Codes
|
||||
==========
|
||||
|
||||
|
@ -16,6 +16,7 @@ Contents:
|
||||
usage
|
||||
cli
|
||||
tools
|
||||
exitcodes
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
@ -195,7 +195,7 @@ def main(argv=None):
|
||||
args = parser.parse_args(argv[1:])
|
||||
if args.version:
|
||||
print(version)
|
||||
sys.exit(0)
|
||||
return 0
|
||||
loglevels = [logging.WARNING, logging.INFO, logging.DEBUG]
|
||||
if args.quiet and not args.log_file:
|
||||
args.verbose = 0
|
||||
@ -307,7 +307,7 @@ def main(argv=None):
|
||||
if not enough_space:
|
||||
logger.error('Not enough space for logs in "%s", exiting.' %
|
||||
nm.conf['archive_dir'])
|
||||
return 2
|
||||
return 100
|
||||
if not args.only_logs:
|
||||
if nm.has(Node.pkey):
|
||||
pretty_run(args.quiet, 'Uploading files', nm.put_files)
|
||||
|
@ -452,7 +452,7 @@ class NodeManager(object):
|
||||
if (not os.path.exists(self.rqdir)):
|
||||
self.logger.critical(('NodeManager: directory %s does not'
|
||||
' exist') % self.rqdir)
|
||||
sys.exit(1)
|
||||
sys.exit(101)
|
||||
if self.conf['rqfile']:
|
||||
self.import_rq()
|
||||
self.nodes = {}
|
||||
@ -495,7 +495,7 @@ class NodeManager(object):
|
||||
if (not self.get_nodes_fuelclient() and
|
||||
not self.get_nodes_api() and
|
||||
not self.get_nodes_cli()):
|
||||
sys.exit(4)
|
||||
sys.exit(105)
|
||||
self.nodes_init()
|
||||
# apply soft-filter on all nodes
|
||||
for node in self.nodes.values():
|
||||
@ -609,7 +609,7 @@ class NodeManager(object):
|
||||
def fuel_init(self):
|
||||
if not self.conf['fuel_ip']:
|
||||
self.logger.critical('NodeManager: fuel_ip not set')
|
||||
sys.exit(7)
|
||||
sys.exit(106)
|
||||
fuelnode = Node(id=0,
|
||||
cluster=0,
|
||||
name='fuel',
|
||||
|
@ -30,6 +30,7 @@ import json
|
||||
from flock import FLock
|
||||
from tempfile import gettempdir
|
||||
from pipes import quote
|
||||
import signal
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
slowpipe = '''
|
||||
@ -51,6 +52,7 @@ def interrupt_wrapper(f):
|
||||
f(*args, **kwargs)
|
||||
except KeyboardInterrupt:
|
||||
logger.warning('Interrupted, exiting.')
|
||||
sys.exit(signal.SIGINT)
|
||||
except Exception as e:
|
||||
logger.error('Error: %s' % e, exc_info=True)
|
||||
for k in dir(e):
|
||||
@ -132,7 +134,7 @@ def run_batch(item_list, maxthreads, dict_result=False):
|
||||
if isinstance(run_item.result, Exception):
|
||||
logger.critical('%s, exiting' % run_item.result)
|
||||
cleanup()
|
||||
sys.exit(42)
|
||||
sys.exit(109)
|
||||
run_item.process.join()
|
||||
run_item.process = None
|
||||
if dict_result:
|
||||
@ -157,10 +159,10 @@ def load_json_file(filename):
|
||||
except IOError as e:
|
||||
logger.critical("I/O error(%s): file: %s; msg: %s" %
|
||||
(e.errno, e.filename, e.strerror))
|
||||
sys.exit(1)
|
||||
sys.exit(107)
|
||||
except ValueError:
|
||||
logger.critical("Could not convert data")
|
||||
sys.exit(1)
|
||||
logger.critical("Could not convert data", exc_info=True)
|
||||
sys.exit(108)
|
||||
|
||||
|
||||
def load_yaml_file(filename):
|
||||
@ -173,14 +175,14 @@ def load_yaml_file(filename):
|
||||
except IOError as e:
|
||||
logger.critical("I/O error(%s): file: %s; msg: %s" %
|
||||
(e.errno, e.filename, e.strerror))
|
||||
sys.exit(1)
|
||||
sys.exit(102)
|
||||
except ValueError:
|
||||
logger.critical("Could not convert data")
|
||||
sys.exit(1)
|
||||
logger.critical("Could not convert data", exc_info=True)
|
||||
sys.exit(103)
|
||||
except yaml.parser.ParserError as e:
|
||||
logger.critical("Could not parse %s:\n%s" %
|
||||
(filename, str(e)))
|
||||
sys.exit(1)
|
||||
sys.exit(105)
|
||||
|
||||
|
||||
def mdir(directory):
|
||||
@ -193,7 +195,7 @@ def mdir(directory):
|
||||
os.makedirs(directory)
|
||||
except:
|
||||
logger.critical("Can't create a directory: %s" % directory)
|
||||
sys.exit(3)
|
||||
sys.exit(110)
|
||||
|
||||
|
||||
def launch_cmd(cmd, timeout, input=None, ok_codes=None, decode=True):
|
||||
|
Loading…
Reference in New Issue
Block a user