]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
keyring: make --key, --keyfile override loaded keyring
authorSage Weil <sage@inktank.com>
Thu, 16 Aug 2012 02:06:04 +0000 (19:06 -0700)
committerSage Weil <sage@inktank.com>
Fri, 17 Aug 2012 23:51:15 +0000 (16:51 -0700)
This way --key, --keyfile still work when a keyring is in the default
search path.

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

index 756a4b583fc35025c5594e88e7ea748d854d0f0e..ad23922d625ffac6663c1848fd6ea6e53012fcb8 100644 (file)
@@ -38,15 +38,14 @@ int KeyRing::from_ceph_context(CephContext *cct)
 {
   const md_config_t *conf = cct->_conf;
 
-  int ret = 0;
+  int ret = -ENOENT;
   string filename;
+
   if (ceph_resolve_file_search(conf->keyring, filename)) {
     ret = load(cct, filename);
-    if (ret == 0)
-      return 0;
-
-    lderr(cct) << "failed to load " << filename
-              << ": " << cpp_strerror(ret) << dendl;
+    if (ret < 0)
+      lderr(cct) << "failed to load " << filename
+                << ": " << cpp_strerror(ret) << dendl;
   }
 
   if (!conf->key.empty()) {
@@ -83,7 +82,7 @@ int KeyRing::from_ceph_context(CephContext *cct)
     return 0;
   }
 
-  return -ENOENT;
+  return ret;
 }
 
 KeyRing *KeyRing::create_empty()