From: Ilya Dryomov Date: Fri, 16 Apr 2021 11:55:56 +0000 (+0200) Subject: common: make y2c.py choke on duplicate keys X-Git-Tag: v17.1.0~2224^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7bef7e9b3b19cbbc3f4f185fe0e0caa2faae544a;p=ceph.git common: make y2c.py choke on duplicate keys Commit 5505fc0051a3 ("common: generate legacy_config_opts.h from .yaml.in files") inadvertently reverted a change of a default value by adding a second "default" key with the old value. This was corrected in commit 75e07f8638ef ("common/options/global: correct default of auth_mon_ticket_ttl"), but highlights that mis-merging a yaml file is rather easy. To prevent this happening again, fail the build if duplicate keys exist in any of src/common/options/*.yaml.in files. Signed-off-by: Ilya Dryomov --- diff --git a/src/common/options/y2c.py b/src/common/options/y2c.py index 8064177296f2..3ff34fa8239a 100755 --- a/src/common/options/y2c.py +++ b/src/common/options/y2c.py @@ -201,6 +201,7 @@ def yaml_to_h(opt): else: return '' + TEMPLATE_CC = '''#include "common/options.h" {headers} @@ -212,6 +213,26 @@ std::vector