Compare commits

...

2 commits

7 changed files with 24 additions and 11 deletions

View file

@ -1,3 +1,9 @@
## 1.2.0a71 (2026-03-18)
### Fix
- auto redefine in type is only for default
## 1.2.0a70 (2026-03-18) ## 1.2.0a70 (2026-03-18)
### Feat ### Feat

View file

@ -1,6 +1,6 @@
[project] [project]
name = "rougail" name = "rougail"
version = "1.2.0a70" version = "1.2.0a71"
[tool.commitizen] [tool.commitizen]
name = "cz_conventional_commits" name = "cz_conventional_commits"

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project] [project]
name = "rougail-base" name = "rougail-base"
version = "1.2.0a70" version = "1.2.0a71"
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"

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project] [project]
name = "rougail" name = "rougail"
version = "1.2.0a70" version = "1.2.0a71"
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"
@ -27,7 +27,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.0a70", "rougail-base == 1.2.0a71",
] ]
[tool.flit.sdist] [tool.flit.sdist]

View file

@ -1 +1 @@
__version__ = "1.2.0a70" __version__ = "1.2.0a71"

View file

@ -409,7 +409,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 and path in self.paths) redefine = self.is_redefine(path, obj, force_redefine)
obj_type = self.get_family_or_variable_type(obj) obj_type = self.get_family_or_variable_type(obj)
family_obj, children_obj = self.split_param_family_children(path, sources, obj_type, obj) family_obj, children_obj = self.split_param_family_children(path, sources, obj_type, obj)
if self.version != "1.0" and not family_obj and comment: if self.version != "1.0" and not family_obj and comment:
@ -522,6 +522,10 @@ class ParserVariable:
copy_before_set=copy_before_set, copy_before_set=copy_before_set,
custom_type=custom_type, custom_type=custom_type,
) )
def is_redefine(self, path: str, obj, force_redefine: bool):
return obj.pop("redefine", False) or (force_redefine is True and path in self.paths and list(obj) in [[], ["default"]])
def split_param_family_children(self, path, sources, obj_type, obj): def split_param_family_children(self, path, sources, obj_type, obj):
family_obj = {} family_obj = {}
children_obj = {} children_obj = {}
@ -716,7 +720,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, copy_before_set) self.parse_secret_manager(path, obj, sources, family_is_dynamic, copy_before_set)
exists = obj.pop("exists", None) exists = obj.pop("exists", None)
redefine = obj.pop("redefine", False) or (force_redefine is True and path in self.paths) redefine = self.is_redefine(path, obj, force_redefine)
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:

View file

@ -24,7 +24,10 @@ my_leadership_4:
my_leadership: my_leadership:
a_leader: # a description a_leader:
description: a description
redefine: true
default:
- a value leader - a value leader
- a second leader - a second leader
... ...