]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/AuthRegistry: only complain about disabling cephx if cephx was enabled
authorSage Weil <sage@redhat.com>
Tue, 5 Feb 2019 11:39:01 +0000 (05:39 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 18:10:34 +0000 (12:10 -0600)
This gets rid of some warnings when auth_supported=none.

Signed-off-by: Sage Weil <sage@redhat.com>
src/auth/AuthRegistry.cc

index b96b0b935a9c7ffe5c3d3065c89f3477615196e0..a7385a833a88e4de6c9de10209d31487fea7e5dc 100644 (file)
@@ -123,20 +123,30 @@ void AuthRegistry::_refresh_config()
 
   // if we have no keyring, filter out cephx
   _no_keyring_disabled_cephx = false;
-  KeyRing k;
-  int r = k.from_ceph_context(cct);
-  if (r == -ENOENT) {
-    for (auto *p : {&cluster_methods, &service_methods, &client_methods}) {
-      auto q = std::find(p->begin(), p->end(), CEPH_AUTH_CEPHX);
-      if (q != p->end()) {
-       p->erase(q);
-       _no_keyring_disabled_cephx = true;
-      }
+  bool any_cephx = false;
+  for (auto *p : {&cluster_methods, &service_methods, &client_methods}) {
+    auto q = std::find(p->begin(), p->end(), CEPH_AUTH_CEPHX);
+    if (q != p->end()) {
+      any_cephx = true;
+      break;
     }
   }
-  if (_no_keyring_disabled_cephx) {
-    lderr(cct) << "no keyring found at " << cct->_conf->keyring
+  if (any_cephx) {
+    KeyRing k;
+    int r = k.from_ceph_context(cct);
+    if (r == -ENOENT) {
+      for (auto *p : {&cluster_methods, &service_methods, &client_methods}) {
+       auto q = std::find(p->begin(), p->end(), CEPH_AUTH_CEPHX);
+       if (q != p->end()) {
+         p->erase(q);
+         _no_keyring_disabled_cephx = true;
+       }
+      }
+    }
+    if (_no_keyring_disabled_cephx) {
+      lderr(cct) << "no keyring found at " << cct->_conf->keyring
               << ", disabling cephx" << dendl;
+    }
   }
 }