diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d8231e0197..bc4805ed71 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -32,6 +32,9 @@ Fixed * Fix and reenable prance-based openapi spec validation, but make our custom ``x-api-model`` validation optional as the spec is out-of-date. #5709 Contributed by @cognifloyd +* Fixed generation of `st2.conf.sample` to show correct syntax for `[sensorcontainer].partition_provider` (space separated `key:value` pairs). #5710 + Contributed by @cognifloyd + Added ~~~~~ diff --git a/Makefile b/Makefile index 2c78a90b2b..1294243f0b 100644 --- a/Makefile +++ b/Makefile @@ -317,10 +317,7 @@ configgen: requirements .configgen @echo @echo "================== config gen ====================" @echo - echo "# Sample config which contains all the available options which the corresponding descriptions" > conf/st2.conf.sample; - echo "# Note: This file is automatically generated using tools/config_gen.py - DO NOT UPDATE MANUALLY" >> conf/st2.conf.sample - echo "" >> conf/st2.conf.sample - . $(VIRTUALENV_DIR)/bin/activate; python ./tools/config_gen.py >> conf/st2.conf.sample; + . $(VIRTUALENV_DIR)/bin/activate; python ./tools/config_gen.py > conf/st2.conf.sample; .PHONY: schemasgen schemasgen: requirements .schemasgen diff --git a/conf/st2.conf.sample b/conf/st2.conf.sample index 20f4e3ac5c..5450a9e4d1 100644 --- a/conf/st2.conf.sample +++ b/conf/st2.conf.sample @@ -278,7 +278,7 @@ version = 4 # location of the logging.conf file logging = /etc/st2/logging.sensorcontainer.conf # Provider of sensor node partition config. -partition_provider = {'name': 'default'} +partition_provider = name:default # name of the sensor node. sensor_node_name = sensornode1 # Run in a single sensor mode where parent process exits when a sensor crashes / dies. This is useful in environments where partitioning, sensor process life cycle and failover is handled by a 3rd party service such as kubernetes. diff --git a/tools/config_gen.py b/tools/config_gen.py index aeb792e045..aeba38ff0e 100755 --- a/tools/config_gen.py +++ b/tools/config_gen.py @@ -77,6 +77,11 @@ "webui": {"webui_base_url": "https://localhost"}, } +INIT_COMMENT = """ +# Sample config which contains all the available options which the corresponding descriptions +# Note: This file is automatically generated using tools/config_gen.py - DO NOT UPDATE MANUALLY +""".strip() + COMMON_AUTH_OPTIONS_COMMENT = """ # Common option - options below apply in both scenarios - when auth service is running as a WSGI # service (e.g. under Apache or Nginx) and when it's running in the standalone mode. @@ -170,6 +175,10 @@ def _print_options(opt_group, options): value = "" value += " # comma separated list allowed here." + elif isinstance(opt.default, dict): + # this is for [sensorcontainer].partition_provider which + # is a generic cfg.Opt(type=types.Dict(value_type=types.String()) + value = " ".join([f"{k}:{v}" for k, v in opt.default.items()]) else: value = opt.default @@ -186,6 +195,8 @@ def _print_options(opt_group, options): def main(args): + print(INIT_COMMENT) + print("") opt_groups = {} for config in CONFIGS: mod = _import_config(config)