From: Patrick Donnelly Date: Fri, 30 May 2025 18:47:07 +0000 (-0400) Subject: mon: cleanup for loop X-Git-Tag: testing/wip-pdonnell-testing-20260126.152838~50 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b051ade50d30eacec29535c3153d5f5e4bfa372f;p=ceph-ci.git mon: cleanup for loop Signed-off-by: Patrick Donnelly --- diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index a4ea05e45a8..24d38fce900 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -141,6 +141,7 @@ struct KeyServerData { bool get_caps(CephContext *cct, const EntityName& name, const std::string& type, AuthCapsInfo& caps) const; + auto const& get_secrets() const { return secrets; } std::map::iterator secrets_begin() { return secrets.begin(); } std::map::const_iterator secrets_begin() const diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 5e245f50bce..e5282f0cd36 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -470,15 +470,13 @@ void AuthMonitor::encode_pending(MonitorDBStore::TransactionRef t) // health auto& next = get_health_checks_pending_writeable(); map> bad_detail; // entity -> details - for (auto i = mon.key_server.secrets_begin(); - i != mon.key_server.secrets_end(); - ++i) { - for (auto& p : i->second.caps) { + for (auto const& [entity, auth] : mon.key_server.get_secrets()) { + for (auto& p : auth.caps) { ostringstream ss; if (!valid_caps(p.first, p.second, &ss)) { ostringstream ss2; - ss2 << i->first << " " << ss.str(); - bad_detail[i->first.to_str()].push_back(ss2.str()); + ss2 << entity << " " << ss.str(); + bad_detail[entity.to_str()].push_back(ss2.str()); } } }