Compare commits
No commits in common. "6ae9662e75a1ed4eb71edfd4af23ce93fa9ff323" and "bc27a98229140546d3ddfdb79345f8dc11755c79" have entirely different histories.
6ae9662e75
...
bc27a98229
11 changed files with 9 additions and 102 deletions
|
|
@ -1,9 +1,3 @@
|
||||||
## 1.2.0a55 (2026-01-15)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- better custom types support
|
|
||||||
|
|
||||||
## 1.2.0a54 (2026-01-14)
|
## 1.2.0a54 (2026-01-14)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "rougail"
|
name = "rougail"
|
||||||
version = "1.2.0a55"
|
version = "1.2.0a54"
|
||||||
|
|
||||||
[tool.commitizen]
|
[tool.commitizen]
|
||||||
name = "cz_conventional_commits"
|
name = "cz_conventional_commits"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail-base"
|
name = "rougail-base"
|
||||||
version = "1.2.0a55"
|
version = "1.2.0a54"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "A consistency handling system that was initially designed in the configuration management"
|
description = "A consistency handling system that was initially designed in the configuration management"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail"
|
name = "rougail"
|
||||||
version = "1.2.0a55"
|
version = "1.2.0a54"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
description = "A consistency handling system that was initially designed in the configuration management"
|
description = "A consistency handling system that was initially designed in the configuration management"
|
||||||
classifiers = [
|
classifiers = [
|
||||||
|
|
@ -18,7 +18,7 @@ classifiers = [
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ruamel.yaml ~= 0.18.6",
|
"ruamel.yaml ~= 0.18.6",
|
||||||
"pydantic ~= 2.9.2",
|
"pydantic ~= 2.9.2",
|
||||||
"rougail-base == 1.2.0a55",
|
"rougail-base == 1.2.0a54",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.flit.sdist]
|
[tool.flit.sdist]
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__ = "1.2.0a55"
|
__version__ = "1.2.0a54"
|
||||||
|
|
|
||||||
|
|
@ -344,8 +344,6 @@ class ParserVariable:
|
||||||
family_is_leadership: bool = False,
|
family_is_leadership: bool = False,
|
||||||
family_is_dynamic: bool = False,
|
family_is_dynamic: bool = False,
|
||||||
parent_dynamic: Optional[str] = None,
|
parent_dynamic: Optional[str] = None,
|
||||||
copy_before_set: bool = False,
|
|
||||||
force_redefine: bool = False,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
if name.startswith("_"):
|
if name.startswith("_"):
|
||||||
msg = f'the variable or family name "{name}" is incorrect, it must not starts with "_" character'
|
msg = f'the variable or family name "{name}" is incorrect, it must not starts with "_" character'
|
||||||
|
|
@ -379,8 +377,6 @@ class ParserVariable:
|
||||||
family_is_leadership=family_is_leadership,
|
family_is_leadership=family_is_leadership,
|
||||||
family_is_dynamic=family_is_dynamic,
|
family_is_dynamic=family_is_dynamic,
|
||||||
parent_dynamic=parent_dynamic,
|
parent_dynamic=parent_dynamic,
|
||||||
copy_before_set=copy_before_set,
|
|
||||||
force_redefine=force_redefine,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def parse_family(
|
def parse_family(
|
||||||
|
|
@ -396,8 +392,6 @@ class ParserVariable:
|
||||||
family_is_leadership: bool = False,
|
family_is_leadership: bool = False,
|
||||||
family_is_dynamic: bool = False,
|
family_is_dynamic: bool = False,
|
||||||
parent_dynamic: Optional[str] = None,
|
parent_dynamic: Optional[str] = None,
|
||||||
copy_before_set: bool = False,
|
|
||||||
force_redefine: Union[bool, str] = False,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Parse a family"""
|
"""Parse a family"""
|
||||||
if obj is None:
|
if obj is None:
|
||||||
|
|
@ -408,7 +402,7 @@ class ParserVariable:
|
||||||
exists = obj.pop("exists", None)
|
exists = obj.pop("exists", None)
|
||||||
else:
|
else:
|
||||||
exists = None
|
exists = None
|
||||||
redefine = obj.pop("redefine", False) or force_redefine is True
|
redefine = obj.pop("redefine", False)
|
||||||
obj_type = self.get_family_or_variable_type(obj)
|
obj_type = self.get_family_or_variable_type(obj)
|
||||||
force_to_attrs = list(self.list_attributes(obj, sources, obj_type))
|
force_to_attrs = list(self.list_attributes(obj, sources, obj_type))
|
||||||
for key, value in obj.items():
|
for key, value in obj.items():
|
||||||
|
|
@ -433,9 +427,7 @@ class ParserVariable:
|
||||||
"", # comment
|
"", # comment
|
||||||
family_is_dynamic=family_is_dynamic,
|
family_is_dynamic=family_is_dynamic,
|
||||||
parent_dynamic=parent_dynamic,
|
parent_dynamic=parent_dynamic,
|
||||||
copy_before_set=True,
|
|
||||||
)
|
)
|
||||||
force_redefine=True
|
|
||||||
family_obj["type"] = self.paths[path].type
|
family_obj["type"] = self.paths[path].type
|
||||||
if path in self.paths:
|
if path in self.paths:
|
||||||
# it's just for modify subfamily or subvariable, do not redefine
|
# it's just for modify subfamily or subvariable, do not redefine
|
||||||
|
|
@ -502,10 +494,7 @@ class ParserVariable:
|
||||||
if self.paths[path].type == "leadership":
|
if self.paths[path].type == "leadership":
|
||||||
family_is_leadership = True
|
family_is_leadership = True
|
||||||
for idx, key in enumerate(subfamily_obj):
|
for idx, key in enumerate(subfamily_obj):
|
||||||
if copy_before_set:
|
value = subfamily_obj[key]
|
||||||
value = subfamily_obj[key].copy()
|
|
||||||
else:
|
|
||||||
value = subfamily_obj[key]
|
|
||||||
first_variable = not force_not_first and idx == 0
|
first_variable = not force_not_first and idx == 0
|
||||||
if isinstance(obj, CommentedMap):
|
if isinstance(obj, CommentedMap):
|
||||||
comment = self.get_comment(key, obj)
|
comment = self.get_comment(key, obj)
|
||||||
|
|
@ -521,8 +510,6 @@ class ParserVariable:
|
||||||
family_is_leadership=family_is_leadership,
|
family_is_leadership=family_is_leadership,
|
||||||
family_is_dynamic=family_is_dynamic,
|
family_is_dynamic=family_is_dynamic,
|
||||||
parent_dynamic=parent_dynamic,
|
parent_dynamic=parent_dynamic,
|
||||||
force_redefine=force_redefine,
|
|
||||||
copy_before_set=copy_before_set,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def list_attributes(
|
def list_attributes(
|
||||||
|
|
@ -670,8 +657,6 @@ class ParserVariable:
|
||||||
family_is_leadership: bool = False,
|
family_is_leadership: bool = False,
|
||||||
family_is_dynamic: bool = False,
|
family_is_dynamic: bool = False,
|
||||||
parent_dynamic: Optional[str] = None,
|
parent_dynamic: Optional[str] = None,
|
||||||
copy_before_set: bool = False,
|
|
||||||
force_redefine: bool = False,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Parse variable"""
|
"""Parse variable"""
|
||||||
if self.version == "1.0" or isinstance(obj, dict):
|
if self.version == "1.0" or isinstance(obj, dict):
|
||||||
|
|
@ -699,7 +684,7 @@ class ParserVariable:
|
||||||
self.parse_params(path, obj, sources)
|
self.parse_params(path, obj, sources)
|
||||||
self.parse_secret_manager(path, obj, sources, family_is_dynamic)
|
self.parse_secret_manager(path, obj, sources, family_is_dynamic)
|
||||||
exists = obj.pop("exists", None)
|
exists = obj.pop("exists", None)
|
||||||
redefine = obj.pop("redefine", False) or force_redefine is True
|
redefine = obj.pop("redefine", False)
|
||||||
if not redefine and not exists:
|
if not redefine and not exists:
|
||||||
obj_type = obj.get("type")
|
obj_type = obj.get("type")
|
||||||
if obj_type in self.custom_variable_types:
|
if obj_type in self.custom_variable_types:
|
||||||
|
|
@ -801,16 +786,7 @@ class ParserVariable:
|
||||||
"""Parse variable params"""
|
"""Parse variable params"""
|
||||||
if "params" not in obj:
|
if "params" not in obj:
|
||||||
return
|
return
|
||||||
if isinstance(obj["params"], list):
|
if not isinstance(obj["params"], dict):
|
||||||
for v in obj["params"]:
|
|
||||||
if not isinstance(v, AnyParam):
|
|
||||||
raise DictConsistencyError(
|
|
||||||
_("params must be a dict for {0}").format(path),
|
|
||||||
55,
|
|
||||||
sources,
|
|
||||||
)
|
|
||||||
return
|
|
||||||
elif not isinstance(obj["params"], dict):
|
|
||||||
raise DictConsistencyError(
|
raise DictConsistencyError(
|
||||||
_("params must be a dict for {0}").format(path),
|
_("params must be a dict for {0}").format(path),
|
||||||
55,
|
55,
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,6 @@ except ModuleNotFoundError:
|
||||||
|
|
||||||
def display_xmlfiles(xmlfiles: list) -> str:
|
def display_xmlfiles(xmlfiles: list) -> str:
|
||||||
"""The function format xmlfiles informations to generate errors"""
|
"""The function format xmlfiles informations to generate errors"""
|
||||||
if not isinstance(xmlfiles, list):
|
|
||||||
xmlfiles = [xmlfiles]
|
|
||||||
if len(xmlfiles) == 1:
|
if len(xmlfiles) == 1:
|
||||||
return '"' + xmlfiles[0] + '"'
|
return '"' + xmlfiles[0] + '"'
|
||||||
return '"' + '", "'.join(xmlfiles[:-1]) + '"' + " and " + '"' + xmlfiles[-1] + '"'
|
return '"' + '", "'.join(xmlfiles[:-1]) + '"' + " and " + '"' + xmlfiles[-1] + '"'
|
||||||
|
|
|
||||||
|
|
@ -55,15 +55,3 @@ def test_type_variables():
|
||||||
|
|
||||||
def test_type_family():
|
def test_type_family():
|
||||||
type_variable("family")
|
type_variable("family")
|
||||||
|
|
||||||
|
|
||||||
def test_type_family_redefine():
|
|
||||||
type_variable("family_redefine")
|
|
||||||
|
|
||||||
|
|
||||||
def test_type_family_subfamily():
|
|
||||||
type_variable("family_subfamily")
|
|
||||||
|
|
||||||
|
|
||||||
def test_type_variable_hidden():
|
|
||||||
type_variable("variable_hidden")
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
from tiramisu import *
|
|
||||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
|
||||||
from re import compile as re_compile
|
|
||||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
|
||||||
try:
|
|
||||||
groups.namespace
|
|
||||||
except:
|
|
||||||
groups.addgroup('namespace')
|
|
||||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
|
||||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
|
||||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
|
||||||
option_3 = StrOption(name="a_first_variable", doc="a first variable", default="a modified value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml', 'tests/types/structures/family_redefine/00_structure.yml'], 'type': 'string'})
|
|
||||||
option_4 = StrOption(name="a_second_variable", doc="a second variable", default="a modified value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml', 'tests/types/structures/family_redefine/00_structure.yml'], 'type': 'string'})
|
|
||||||
optiondescription_2 = OptionDescription(name="my_family_1", doc="My family type", children=[option_3, option_4], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml', 'tests/types/structures/family_redefine/00_structure.yml']})
|
|
||||||
option_6 = StrOption(name="a_first_variable", doc="a first variable", default="a value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml'], 'type': 'string'})
|
|
||||||
option_7 = StrOption(name="a_second_variable", doc="a second variable", properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml'], 'type': 'string'})
|
|
||||||
optiondescription_5 = OptionDescription(name="my_family_2", doc="My family type", children=[option_6, option_7], properties=frozenset({"basic"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml', 'tests/types/structures/family_redefine/00_structure.yml']})
|
|
||||||
option_9 = StrOption(name="a_first_variable", doc="a first variable", default="a value", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml'], 'type': 'string'})
|
|
||||||
option_10 = StrOption(name="a_second_variable", doc="a second variable", default="a modified value 2", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml', 'tests/types/structures/family_redefine/00_structure.yml'], 'type': 'string'})
|
|
||||||
optiondescription_8 = OptionDescription(name="my_family_3", doc="My family type", children=[option_9, option_10], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_redefine/00_structure.yml', 'tests/types/structures/family_redefine/00_structure.yml']})
|
|
||||||
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", group_type=groups.namespace, children=[optiondescription_2, optiondescription_5, optiondescription_8], properties=frozenset({"basic"}))
|
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"rougail.my_family_1.a_first_variable": "a modified value",
|
|
||||||
"rougail.my_family_1.a_second_variable": "a modified value",
|
|
||||||
"rougail.my_family_2.a_first_variable": "a value",
|
|
||||||
"rougail.my_family_2.a_second_variable": null,
|
|
||||||
"rougail.my_family_3.a_first_variable": "a value",
|
|
||||||
"rougail.my_family_3.a_second_variable": "a modified value 2"
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
my_family_1:
|
|
||||||
type: my_family_type
|
|
||||||
|
|
||||||
a_first_variable: a modified value
|
|
||||||
|
|
||||||
a_second_variable: a modified value
|
|
||||||
|
|
||||||
my_family_2:
|
|
||||||
type: my_family_type
|
|
||||||
|
|
||||||
my_family_3:
|
|
||||||
type: my_family_type
|
|
||||||
|
|
||||||
a_second_variable: a modified value 2
|
|
||||||
...
|
|
||||||
Loading…
Reference in a new issue