]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fetch_config: enable fetching ceph.conf from a remote location
authorSage Weil <sage@newdream.net>
Tue, 20 Apr 2010 22:25:00 +0000 (15:25 -0700)
committerSage Weil <sage@newdream.net>
Tue, 20 Apr 2010 23:38:48 +0000 (16:38 -0700)
fetch_config: always fetch if script exists and is executable

fetch_config: make /etc/ceph/sample.fetch_config +x

Makefile: fix whitespace

debian/ceph.install
debian/rules
src/Makefile.am
src/ceph_common.sh
src/fetch_config [new file with mode: 0644]

index 997c4ff2b60279c641e2eec7d2442242b3739e15..ef27edae178f5d89a910ab0e59bfe0efb7245d9c 100644 (file)
@@ -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
index cb78c6ce69d614f28e08b368b5d4b17b87993ddd..3ca114c5e1e53662d03a6bb4b4828d5534b56628 100755 (executable)
@@ -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.
index ddb65d0c9532f752f844ab359c21f7d1c3106567..65925545186ca8f92b3d5ab50cbfd0cfdea310c5 100644 (file)
@@ -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\
index 4f6dcea9aa774de9f908c0babd5fdd6170d53d5a..9bec4e4d84f2772a511e27d0007aa9e2f9ee1d0f 100644 (file)
@@ -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 (file)
index 0000000..f0787b6
--- /dev/null
@@ -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
+