From b8c78bd44ea07dbae759a618603ba1a8ebe8025a Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Sun, 29 Jul 2018 19:32:20 +0200 Subject: [PATCH] tools: ceph-authtool: report correct number of caps when creating Fixes: https://tracker.ceph.com/issues/23776 Signed-off-by: Nathan Cutler --- src/auth/Auth.h | 2 +- src/tools/ceph_authtool.cc | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/auth/Auth.h b/src/auth/Auth.h index db1980a3ca6..aac83632bf9 100644 --- a/src/auth/Auth.h +++ b/src/auth/Auth.h @@ -47,7 +47,7 @@ struct EntityAuth { WRITE_CLASS_ENCODER(EntityAuth) static inline ostream& operator<<(ostream& out, const EntityAuth& a) { - return out << "auth(key=" << a.key << " with " << a.caps.size() << " caps)"; + return out << "auth(key=" << a.key << ")"; } struct AuthCapsInfo { diff --git a/src/tools/ceph_authtool.cc b/src/tools/ceph_authtool.cc index c65d58c9b49..f5a78c52726 100644 --- a/src/tools/ceph_authtool.cc +++ b/src/tools/ceph_authtool.cc @@ -173,6 +173,7 @@ int main(int argc, const char **argv) // keyring -------- bool modified = false; + bool added_entity = false; KeyRing keyring; bufferlist bl; @@ -248,7 +249,8 @@ int main(int argc, const char **argv) } keyring.add(ename, eauth); modified = true; - cout << "added entity " << ename << " auth " << eauth << std::endl; + cout << "added entity " << ename << " " << eauth << std::endl; + added_entity = true; } if (!caps_fn.empty()) { ConfFile cf; @@ -276,6 +278,9 @@ int main(int argc, const char **argv) keyring.set_caps(ename, caps); modified = true; } + if (added_entity && caps.size() > 0) { + cout << "added " << caps.size() << " caps to entity " << ename << std::endl; + } // read commands if (list) { -- 2.47.3