/usr/bin/ceph-rest-api is in ceph 10.1.2-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #! /usr/bin/python
# vim: ts=4 sw=4 smarttab expandtab
import argparse
import inspect
import os
import sys
# Make life easier on developers
MYPATH = os.path.abspath(__file__)
MYDIR = os.path.dirname(MYPATH)
DEVMODEMSG = '*** DEVELOPER MODE: setting PYTHONPATH and LD_LIBRARY_PATH'
if MYDIR.endswith('src') and \
os.path.exists(os.path.join(MYDIR, '.libs')) and \
os.path.exists(os.path.join(MYDIR, 'pybind')):
MYLIBPATH = os.path.join(MYDIR, '.libs')
if 'LD_LIBRARY_PATH' in os.environ:
if MYLIBPATH not in os.environ['LD_LIBRARY_PATH']:
os.environ['LD_LIBRARY_PATH'] += ':' + MYLIBPATH
print >> sys.stderr, DEVMODEMSG
os.execvp('python', ['python'] + sys.argv)
else:
os.environ['LD_LIBRARY_PATH'] = MYLIBPATH
print >> sys.stderr, DEVMODEMSG
os.execvp('python', ['python'] + sys.argv)
sys.path.insert(0, os.path.join(MYDIR, 'pybind'))
def parse_args():
parser = argparse.ArgumentParser(description="Ceph REST API webapp")
parser.add_argument('-c', '--conf', help='Ceph configuration file')
parser.add_argument('--cluster', help='Ceph cluster name')
parser.add_argument('-n', '--name', help='Ceph client name')
parser.add_argument('-i', '--id', help='Ceph client id')
return parser.parse_known_args()
# main
parsed_args, rest = parse_args()
# import now that env vars are available to imported module
try:
import ceph_rest_api
except EnvironmentError as e:
print >> sys.stderr, "Error importing ceph_rest_api: ", str(e)
sys.exit(1)
# let other exceptions generate traceback
app = ceph_rest_api.generate_app(
parsed_args.conf,
parsed_args.cluster,
parsed_args.name,
parsed_args.id,
rest,
)
files = [os.path.split(fr[1])[-1] for fr in inspect.stack()]
if 'pdb.py' in files:
app.run(host=app.ceph_addr, port=app.ceph_port,
debug=True, use_reloader=False, use_debugger=False)
else:
app.run(host=app.ceph_addr, port=app.ceph_port)
|