Skip to content

Commit

Permalink
keyring: clean up error output
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed May 5, 2012
1 parent ae0ca7b commit a4b42fc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/auth/KeyRing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int KeyRing::from_ceph_context(CephContext *cct, KeyRing **pkeyring)
AuthSupported supported(cct);

if (!supported.is_supported_auth(CEPH_AUTH_CEPHX)) {
ldout(cct, 2) << "KeyRing::from_ceph_context: CephX auth is not supported." << dendl;
ldout(cct, 2) << "CephX auth is not supported." << dendl;
*pkeyring = keyring.release();
return 0;
}
Expand All @@ -53,7 +53,7 @@ int KeyRing::from_ceph_context(CephContext *cct, KeyRing **pkeyring)
if (ceph_resolve_file_search(conf->keyring, filename)) {
ret = keyring->load(cct, filename);
if (ret) {
lderr(cct) << "KeyRing::from_ceph_context: failed to load " << filename
lderr(cct) << "failed to load " << filename
<< ": " << cpp_strerror(ret) << dendl;
} else {
found_key = true;
Expand All @@ -68,7 +68,7 @@ int KeyRing::from_ceph_context(CephContext *cct, KeyRing **pkeyring)
found_key = true;
}
catch (buffer::error& e) {
lderr(cct) << "KeyRing::from_ceph_context: failed to decode key " << conf->key << dendl;
lderr(cct) << "failed to decode key '" << conf->key << "'" << dendl;
return -EINVAL;
}
}
Expand All @@ -80,8 +80,7 @@ int KeyRing::from_ceph_context(CephContext *cct, KeyRing **pkeyring)
int res = fread(buf, 1, sizeof(buf) - 1, fp);
if (res < 0) {
res = ferror(fp);
lderr(cct) << "KeyRing::from_ceph_context: failed to read '" << conf->keyfile
<< "'" << dendl;
lderr(cct) << "failed to read '" << conf->keyfile << "'" << dendl;
}
else {
string k = buf;
Expand All @@ -92,14 +91,14 @@ int KeyRing::from_ceph_context(CephContext *cct, KeyRing **pkeyring)
found_key = true;
}
catch (buffer::error& e) {
lderr(cct) << "KeyRing::from_ceph_context: failed to decode key " << k << dendl;
lderr(cct) << "failed to decode key '" << k << "'" << dendl;
return -EINVAL;
}
}
fclose(fp);
} else {
ret = errno;
lderr(cct) << "KeyRing::conf_ceph_context: failed to open " << conf->keyfile
lderr(cct) << "failed to open " << conf->keyfile
<< ": " << cpp_strerror(ret) << dendl;
}
}
Expand Down

0 comments on commit a4b42fc

Please sign in to comment.