]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: bootstrap-osd keyring ignores --statedir 2635/head
authorLoic Dachary <loic-201408@dachary.org>
Fri, 3 Oct 2014 12:08:57 +0000 (14:08 +0200)
committerLoic Dachary <loic-201408@dachary.org>
Fri, 3 Oct 2014 13:53:28 +0000 (15:53 +0200)
The STATEDIR variable is used to initialize the bootstrap-osd keyring
before it gets a chance to be overriden by --statedir. Replace it with
{statedir} so that it can be substituted after all options have been
parsed.

http://tracker.ceph.com/issues/9653 Fixes: #9653

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit fa0bd06b4657e5b84e237b76033ac3d3478b6a1f)

src/ceph-disk
src/test/ceph-disk.sh

index 8475c56811657a5d0a67504b6bf01ad3fa245cc1..90f706ff9813485ada62a1c057d2879c9f80fa91 100755 (executable)
@@ -1919,7 +1919,8 @@ def activate(
         raise Error('No OSD uuid assigned.')
     LOG.debug('OSD uuid is %s', fsid)
 
-    keyring = activate_key_template.format(cluster=cluster)
+    keyring = activate_key_template.format(cluster=cluster,
+                                           statedir=STATEDIR)
 
     osd_id = get_osd_id(path)
     if osd_id is None:
@@ -2658,7 +2659,7 @@ def parse_args():
         help='path to block device or directory',
         )
     activate_parser.set_defaults(
-        activate_key_template=STATEDIR + '/bootstrap-osd/{cluster}.keyring',
+        activate_key_template='{statedir}/bootstrap-osd/{cluster}.keyring',
         func=main_activate,
         )
 
@@ -2682,7 +2683,7 @@ def parse_args():
         choices=INIT_SYSTEMS,
         )
     activate_journal_parser.set_defaults(
-        activate_key_template=STATEDIR + '/bootstrap-osd/{cluster}.keyring',
+        activate_key_template='{statedir}/bootstrap-osd/{cluster}.keyring',
         func=main_activate_journal,
         )
 
@@ -2701,7 +2702,7 @@ def parse_args():
         choices=INIT_SYSTEMS,
         )
     activate_all_parser.set_defaults(
-        activate_key_template=STATEDIR + '/bootstrap-osd/{cluster}.keyring',
+        activate_key_template='{statedir}/bootstrap-osd/{cluster}.keyring',
         func=main_activate_all,
         )
 
index 49ede4821ab69340f75321a7f3575b008f033c82..bb6e83803661a47b8c9567db42ea419ff590fc18 100755 (executable)
@@ -218,6 +218,12 @@ function test_find_cluster_by_uuid() {
     teardown
 }
 
+# http://tracker.ceph.com/issues/9653
+function test_keyring_path() {
+    test_activate_dir 2>&1 | tee $DIR/test_keyring
+    grep --quiet "keyring $DIR/bootstrap-osd/ceph.keyring" $DIR/test_keyring || return 1
+}
+
 function run() {
     local default_actions
     default_actions+="test_path "
@@ -226,6 +232,7 @@ function run() {
     default_actions+="test_prepend_to_path "
     default_actions+="test_activate_dir_magic "
     default_actions+="test_activate_dir "
+    default_actions+="test_keyring_path "
     local actions=${@:-$default_actions}
     for action in $actions  ; do
         setup