diff options
author | Sage Weil <sage@newdream.net> | 2010-04-21 00:25:00 +0200 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-04-21 01:38:48 +0200 |
commit | ba5a0d1ff6cdb9e3a26637fee37cd4e3e227b8c9 (patch) | |
tree | 81eedbe9b0b5ab60fddf0a6075e4ab33f09f5d5d | |
parent | osd: don't capture SIGINT/SIGTERM; journal and/or btrfs snaps are sufficient. (diff) | |
download | ceph-ba5a0d1ff6cdb9e3a26637fee37cd4e3e227b8c9.tar.xz ceph-ba5a0d1ff6cdb9e3a26637fee37cd4e3e227b8c9.zip |
fetch_config: enable fetching ceph.conf from a remote location
fetch_config: always fetch if script exists and is executable
fetch_config: make /etc/ceph/sample.fetch_config +x
Makefile: fix whitespace
-rw-r--r-- | debian/ceph.install | 1 | ||||
-rwxr-xr-x | debian/rules | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/ceph_common.sh | 26 | ||||
-rw-r--r-- | src/fetch_config | 20 |
5 files changed, 42 insertions, 9 deletions
diff --git a/debian/ceph.install b/debian/ceph.install index 997c4ff2b60..ef27edae178 100644 --- a/debian/ceph.install +++ b/debian/ceph.install @@ -16,6 +16,7 @@ sbin/mount.ceph usr/sbin/mkcephfs usr/lib/ceph/ceph_common.sh etc/ceph/sample.ceph.conf +etc/ceph/sample.fetch_config usr/share/man/man8/cmon.8 usr/share/man/man8/cmds.8 usr/share/man/man8/cosd.8 diff --git a/debian/rules b/debian/rules index cb78c6ce69d..3ca114c5e1e 100755 --- a/debian/rules +++ b/debian/rules @@ -38,7 +38,7 @@ install: build $(MAKE) DESTDIR=$(CURDIR) install mkdir -p etc/ceph - cp src/sample.ceph.conf etc/ceph + mv usr/etc/ceph/* etc/ceph # Add here commands to install the package into debian/testpack. diff --git a/src/Makefile.am b/src/Makefile.am index ddb65d0c953..65925545186 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -269,6 +269,7 @@ install-data-local: $(install_sh_SCRIPT) -m 0755 ceph_common.sh $(DESTDIR)$(libdir)/ceph/ceph_common.sh mkdir -p $(DESTDIR)$(sysconfdir)/ceph $(install_sh_SCRIPT) -m 0600 sample.ceph.conf $(DESTDIR)$(sysconfdir)/ceph/sample.ceph.conf + $(install_sh_SCRIPT) -m 0755 fetch_config $(DESTDIR)$(sysconfdir)/ceph/sample.fetch_config mkdir -p $(DESTDIR)$(includedir)/ceph $(install_sh_SCRIPT) -m 0644 client/libceph.h $(DESTDIR)$(includedir)/ceph/libceph.h mkdir -p $(DESTDIR)$(includedir)/rados @@ -497,6 +498,7 @@ noinst_HEADERS = \ crush/mapper.h\ crush/sample.txt\ crush/types.h\ + fetch_config\ include/ClassLibrary.h\ include/Context.h\ include/CompatSet.h\ diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 4f6dcea9aa7..9bec4e4d84f 100644 --- a/src/ceph_common.sh +++ b/src/ceph_common.sh @@ -20,15 +20,25 @@ figure_dirs() { } verify_conf() { - # make sure ceph.conf exists - - if [ ! -e $conf ]; then - if [ "$conf" = "$default_conf" ]; then - echo "$0: ceph conf $conf not found; system is not configured." - exit 0 + # fetch conf? + if [ -x "$ETCDIR/fetch_config" ] && [ "$conf" = "$default_conf" ]; then + conf="/tmp/fetched.ceph.conf.$$" + echo "[$ETCDIR/fetch_config $conf]" + if $ETCDIR/fetch_config $conf && [ -e $conf ]; then true ; else + echo "$0: failed to fetch config with '$ETCDIR/fetch_config $conf'" + exit 1 + fi + # yay! + else + # make sure ceph.conf exists + if [ ! -e $conf ]; then + if [ "$conf" = "$default_conf" ]; then + echo "$0: ceph conf $conf not found; system is not configured." + exit 0 + fi + echo "$0: ceph conf $conf not found!" + usage_exit fi - echo "$0: ceph conf $conf not found!" - usage_exit fi } diff --git a/src/fetch_config b/src/fetch_config new file mode 100644 index 00000000000..f0787b689b4 --- /dev/null +++ b/src/fetch_config @@ -0,0 +1,20 @@ +#!/bin/sh +conf="$1" + +## fetch ceph.conf from some remote location and save it to $conf. +## +## make sure this script is executable (chmod +x fetch_config) + +## +## examples: +## + +## from a locally accessible file +# cp /path/to/ceph.conf $conf + +## from a URL: +# wget -q -O $conf http://somewhere.com/some/ceph.conf + +## via scp +# scp -i /path/to/id_dsa user@host:/path/to/ceph.conf $conf + |