60 lines
1.7 KiB
Python
Executable File
60 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import os
|
|
import os.path
|
|
import logging
|
|
import logging.config
|
|
import sys
|
|
import traceback
|
|
|
|
#this needs to happen immediately (or thats what it seems)
|
|
log_fn = os.getenv('LOG_FILE')
|
|
if(log_fn == None):
|
|
log_fn = os.path.normpath(os.path.join("conf", 'logging.ini'))
|
|
logging.config.fileConfig(log_fn)
|
|
|
|
#this handles our option parsing
|
|
from devstack import opts
|
|
from devstack import utils
|
|
|
|
#these are the program runtimes that actually do the running
|
|
from devstack.progs import actions
|
|
|
|
|
|
def main():
|
|
args = opts.parse()
|
|
try:
|
|
started_ok = actions.run(args)
|
|
if not started_ok:
|
|
me = utils.color_text((os.path.basename(sys.argv[0])), "red", True)
|
|
me += " " + utils.color_text('--help', 'red')
|
|
print("Perhaps you should try %s" % (me))
|
|
return 1
|
|
else:
|
|
utils.goodbye(True)
|
|
return 0
|
|
except Exception:
|
|
utils.goodbye(False)
|
|
traceback.print_exc(file=sys.stdout)
|
|
return 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|