From: Sage Weil Date: Tue, 5 Feb 2019 11:39:01 +0000 (-0600) Subject: auth/AuthRegistry: only complain about disabling cephx if cephx was enabled X-Git-Tag: v14.1.0~183^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eb4af28be4830c4d00c6fe451bf5657554342473;p=ceph.git auth/AuthRegistry: only complain about disabling cephx if cephx was enabled This gets rid of some warnings when auth_supported=none. Signed-off-by: Sage Weil --- diff --git a/src/auth/AuthRegistry.cc b/src/auth/AuthRegistry.cc index b96b0b935a9c..a7385a833a88 100644 --- a/src/auth/AuthRegistry.cc +++ b/src/auth/AuthRegistry.cc @@ -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; + } } }