STATEDIR = '/var/lib/ceph'
+SYSCONFDIR = '/etc/ceph'
+
# Nuke the TERM variable to avoid confusing any subprocesses we call.
# For example, libreadline will print weird control sequences for some
# TERM values.
"""
_uuid = _uuid.lower()
no_fsid = []
- if not os.path.exists('/etc/ceph'):
+ if not os.path.exists(SYSCONFDIR):
return None
- for conf_file in os.listdir('/etc/ceph'):
+ for conf_file in os.listdir(SYSCONFDIR):
if not conf_file.endswith('.conf'):
continue
cluster = conf_file[:-5]
return cluster
# be tolerant of /etc/ceph/ceph.conf without an fsid defined.
if len(no_fsid) == 1 and no_fsid[0] == 'ceph':
- LOG.warning('No fsid defined in /etc/ceph/ceph.conf; using anyway')
+ LOG.warning('No fsid defined in ' + SYSCONFDIR + '/ceph.conf; using anyway')
return 'ceph'
return None
cluster = find_cluster_by_uuid(ceph_fsid)
if cluster is None:
- raise Error('No cluster conf found in /etc/ceph with fsid %s' % ceph_fsid)
+ raise Error('No cluster conf found in ' + SYSCONFDIR + ' with fsid %s' % ceph_fsid)
LOG.debug('Cluster name is %s', cluster)
fsid = read_one_line(path, 'fsid')
global SUPPRESS_PREFIX
SUPPRESS_PREFIX = STATEDIR + '/tmp/suppress-activate.'
+def setup_sysconfdir(dir):
+ global SYSCONFDIR
+ SYSCONFDIR = dir
+
def parse_args():
parser = argparse.ArgumentParser(
'ceph-disk',
default='/var/lib/ceph',
help='directory in which ceph state is preserved (default /var/lib/ceph)',
)
+ parser.add_argument(
+ '--sysconfdir',
+ metavar='PATH',
+ default='/etc/ceph',
+ help='directory in which ceph configuration files are found (default /etc/ceph)',
+ )
parser.set_defaults(
# we want to hold on to this, for later
prog=parser.prog,
os.environ['PATH'] = args.prepend_to_path + ":" + path
setup_statedir(args.statedir)
+ setup_sysconfdir(args.sysconfdir)
+
try:
args.func(args)