]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: don't blow away bootstrap-mgr on upgrades
authorJohn Spray <john.spray@redhat.com>
Thu, 19 Oct 2017 13:28:18 +0000 (09:28 -0400)
committerJohn Spray <john.spray@redhat.com>
Thu, 19 Oct 2017 17:03:57 +0000 (18:03 +0100)
Fixes: http://tracker.ceph.com/issues/20950
Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/AuthMonitor.cc

index ada1ddb4a913319e81b239552cb3026280dc0d71..8bb5f8ecac188a1d3e4f407715d6669f092618ee 100644 (file)
@@ -1551,11 +1551,15 @@ void AuthMonitor::upgrade_format()
       }
     }
 
-    // add bootstrap key
-    {
+    // add bootstrap key if it does not already exist
+    // (might have already been get-or-create'd by
+    //  ceph-create-keys)
+    EntityName bootstrap_mgr_name;
+    int r = bootstrap_mgr_name.from_str("client.bootstrap-mgr");
+    assert(r);
+    if (!mon->key_server.contains(bootstrap_mgr_name)) {
       KeyServerData::Incremental auth_inc;
-      bool r = auth_inc.name.from_str("client.bootstrap-mgr");
-      assert(r);
+      auth_inc.name = bootstrap_mgr_name;
       ::encode("allow profile bootstrap-mgr", auth_inc.auth.caps["mon"]);
       auth_inc.op = KeyServerData::AUTH_INC_ADD;
       // generate key