From 94d07986a695b918b8ca2e2036025be1ca3e6685 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 15 Jun 2022 12:23:18 -0500 Subject: [PATCH 1/4] consolidate st2.conf.sample generation in one place --- Makefile | 5 +---- tools/config_gen.py | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) 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/tools/config_gen.py b/tools/config_gen.py index aeb792e045..bb5a0f2999 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. @@ -186,6 +191,8 @@ def _print_options(opt_group, options): def main(args): + print(INIT_COMMENT) + print("") opt_groups = {} for config in CONFIGS: mod = _import_config(config) From dacb34b506dba1eaf9cfa5976ccf342601a13bf8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 15 Jun 2022 17:46:28 -0500 Subject: [PATCH 2/4] fix dumping [sensorcontainer].partition_provider in st2.conf.sample --- tools/config_gen.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/config_gen.py b/tools/config_gen.py index bb5a0f2999..aeba38ff0e 100755 --- a/tools/config_gen.py +++ b/tools/config_gen.py @@ -175,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 From 61d4c882f5a7c0e84d98ac87552529a6e4bde1d8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 12 Aug 2022 15:27:32 -0500 Subject: [PATCH 3/4] add changelog entry --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) 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 ~~~~~ From 1fa58cad011d6beab513d749f690c08f32ce018e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 12 Aug 2022 15:34:16 -0500 Subject: [PATCH 4/4] regen conf/st2.conf.sample --- conf/st2.conf.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.