]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
auth/cephx: enforce sorted config keys
authorPatrick Donnelly <pdonnell@ibm.com>
Wed, 26 Mar 2025 01:55:22 +0000 (21:55 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Wed, 1 Oct 2025 18:46:48 +0000 (14:46 -0400)
Makes future additions avoid conflicts.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/auth/cephx/CephxServiceHandler.cc

index 19e612b10cb43df4e6a2ce8c44c27e1e255b7d47..8ed135822a3c6eedff1478e5c8a4e91ec05bc0d1 100644 (file)
@@ -46,9 +46,11 @@ CephxServiceHandler::CephxServiceHandler(CephContext *cct_, KeyServer *ks)
 
 std::vector<std::string> CephxServiceHandler::get_tracked_keys() const noexcept
 {
-  return {
-    "cephx_allowed_ciphers"s
-  };
+  static constexpr auto as_sv = std::to_array<std::string_view>({
+    "cephx_allowed_ciphers",
+  });
+  static_assert(std::is_sorted(as_sv.begin(), as_sv.end()), "keys are not sorted!");
+  return {as_sv.begin(), as_sv.end()};
 }
 
 void CephxServiceHandler::init_conf(const ConfigProxy& conf) {