diff --git a/docs/topic/tljh-config.md b/docs/topic/tljh-config.md index 2df93ee1..e56609ba 100644 --- a/docs/topic/tljh-config.md +++ b/docs/topic/tljh-config.md @@ -227,7 +227,7 @@ it after an argument like `remove-item` gives information about this specific co ```bash sudo tljh-config --help -usage: tljh-config [-h] [--config-path CONFIG_PATH] {show,unset,set,add-item,remove-item,reload} ... +usage: tljh-config [-h] [--config-path CONFIG_PATH] [--validate] [--no-validate] {show,unset,set,add-item,remove-item,reload} ... positional arguments: {show,unset,set,add-item,remove-item,reload} @@ -238,10 +238,12 @@ positional arguments: remove-item Remove a value from a list for a configuration property reload Reload a component to apply configuration change -optional arguments: +options: -h, --help show this help message and exit --config-path CONFIG_PATH Path to TLJH config.yaml file + --validate Validate the TLJH config + --no-validate Do not validate the TLJH config ``` ```bash diff --git a/tests/test_config.py b/tests/test_config.py index 2d6ded43..88a752ce 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -220,7 +220,8 @@ def test_cli_remove_int(tljh_dir): ("x", "x"), ("1x", "1x"), ("1.2x", "1.2x"), - (None, None), + ("None", None), + ("none", None), ("", ""), ], ) diff --git a/tljh/config.py b/tljh/config.py index 3b317f93..73fdc1f6 100644 --- a/tljh/config.py +++ b/tljh/config.py @@ -317,8 +317,8 @@ def reload_component(component): def parse_value(value_str): """Parse a value string""" - if value_str is None: - return value_str + if value_str.lower() == "none": + return None if re.match(r"^\d+$", value_str): return int(value_str) elif re.match(r"^\d+\.\d*$", value_str): diff --git a/tljh/config_schema.py b/tljh/config_schema.py index 0b12c8f9..4a17f131 100644 --- a/tljh/config_schema.py +++ b/tljh/config_schema.py @@ -79,7 +79,20 @@ "description": "User CPU and memory limits.", "type": "object", "additionalProperties": False, - "properties": {"memory": {"type": "string"}, "cpu": {"type": "integer"}}, + "properties": { + "memory": { + "anyOf": [ + {"type": "string"}, + {"type": "null"}, + ] + }, + "cpu": { + "anyOf": [ + {"type": "number", "minimum": 0}, + {"type": "null"}, + ] + }, + }, }, "UserEnvironment": { "type": "object",