Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~

Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion conf/st2.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions tools/config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Comment on lines +80 to +83
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's definitely much better place for the config autogenerated note 👍


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.
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down