Compare commits
No commits in common. "439cf7fe2db1d6df3d9ae719a3749d37ee2de34f" and "21f1526891b3f924457acd7b0c9bd27c35d5005a" have entirely different histories.
439cf7fe2d
...
21f1526891
6 changed files with 24 additions and 40 deletions
|
|
@ -1,9 +1,3 @@
|
|||
## 1.2.0a41 (2025-11-06)
|
||||
|
||||
### Feat
|
||||
|
||||
- choice if invalid value or unknown variable in user data is a fatal error or not
|
||||
|
||||
## 1.2.0a40 (2025-11-03)
|
||||
|
||||
### Feat
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "rougail"
|
||||
version = "1.2.0a41"
|
||||
version = "1.2.0a40"
|
||||
|
||||
[tool.commitizen]
|
||||
name = "cz_conventional_commits"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail-base"
|
||||
version = "1.2.0a41"
|
||||
version = "1.2.0a40"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
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]
|
||||
name = "rougail"
|
||||
version = "1.2.0a41"
|
||||
version = "1.2.0a40"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
description = "A consistency handling system that was initially designed in the configuration management"
|
||||
classifiers = [
|
||||
|
|
@ -18,7 +18,7 @@ classifiers = [
|
|||
dependencies = [
|
||||
"ruamel.yaml ~= 0.18.6",
|
||||
"pydantic ~= 2.9.2",
|
||||
"rougail-base == 1.2.0a41",
|
||||
"rougail-base == 1.2.0a40",
|
||||
]
|
||||
|
||||
[tool.flit.sdist]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "1.2.0a41"
|
||||
__version__ = "1.2.0a40"
|
||||
|
|
|
|||
|
|
@ -49,22 +49,16 @@ class UserDatas:
|
|||
self,
|
||||
user_datas: List[dict],
|
||||
*,
|
||||
invalid_user_datas_error: bool = False,
|
||||
unknown_user_datas_error: bool = False,
|
||||
user_datas_type: str = "user_datas",
|
||||
):
|
||||
self.values = {}
|
||||
self.errors = []
|
||||
self.warnings = []
|
||||
if invalid_user_datas_error:
|
||||
self.invalids = self.errors
|
||||
else:
|
||||
self.invalids = self.warnings
|
||||
if unknown_user_datas_error:
|
||||
self.unknowns = self.errors
|
||||
else:
|
||||
self.unknowns = self.warnings
|
||||
self.show_secrets = False
|
||||
if user_datas_type == "user_datas":
|
||||
self._populate_values(user_datas)
|
||||
else:
|
||||
self.values = user_datas
|
||||
self._auto_configure_dynamics()
|
||||
self._populate_config()
|
||||
self.properties_to_string = get_properties_to_string()
|
||||
|
|
@ -132,7 +126,7 @@ class UserDatas:
|
|||
lists = config.list(uncalculated=True)
|
||||
except PropertiesOptionError:
|
||||
lists = []
|
||||
for tconfig in lists:
|
||||
for tconfig in []:
|
||||
if not tconfig.isdynamic(only_self=True):
|
||||
# it's not a dynamic variable
|
||||
continue
|
||||
|
|
@ -145,7 +139,7 @@ class UserDatas:
|
|||
msg = _(
|
||||
'cannot load variable path "{0}", the identifier "{1}" is not valid in {2}'
|
||||
).format(path, identifier, data["source"])
|
||||
self.invalids.append(msg)
|
||||
self.warnings.append(msg)
|
||||
continue
|
||||
if identifier is None:
|
||||
# it's a dynamic variable but doesn't match the current name
|
||||
|
|
@ -304,7 +298,7 @@ class UserDatas:
|
|||
try:
|
||||
if option.isoptiondescription():
|
||||
if value:
|
||||
self.invalids.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'cannot set the value "{0}" to the family {1}, it will be ignored when loading from {2}'
|
||||
).format(
|
||||
|
|
@ -314,25 +308,21 @@ class UserDatas:
|
|||
)
|
||||
)
|
||||
continue
|
||||
except PropertiesOptionError as err:
|
||||
self.unknowns.append(
|
||||
_("{0} loaded from {1}").format(err, options["source"])
|
||||
)
|
||||
except AttributeOptionError as err:
|
||||
if err.code == "option-not-found":
|
||||
self.unknowns.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'variable or family "{0}" does not exist, it will be ignored when loading from {1}'
|
||||
).format(err.path, options["source"])
|
||||
)
|
||||
elif err.code == "option-dynamic":
|
||||
self.invalids.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'"{0}" is the name of a dynamic family, it will be ignored when loading from {1}'
|
||||
).format(option.description(with_quote=True), options["source"])
|
||||
)
|
||||
else:
|
||||
self.invalids.append(
|
||||
self.warnings.append(
|
||||
_("{0} loaded from {1}").format(err, options["source"])
|
||||
)
|
||||
continue
|
||||
|
|
@ -360,7 +350,7 @@ class UserDatas:
|
|||
display_name = option.description(with_quote=True)
|
||||
if index is not None:
|
||||
if path == err_path:
|
||||
self.unknowns.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'variable {0} at index "{1}" is {2}, it will be ignored when loading from {3}'
|
||||
).format(
|
||||
|
|
@ -371,7 +361,7 @@ class UserDatas:
|
|||
)
|
||||
)
|
||||
else:
|
||||
self.unknowns.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'family {0} is {1}, {2} at index "{3}" will be ignored when loading from {4}'
|
||||
).format(
|
||||
|
|
@ -384,7 +374,7 @@ class UserDatas:
|
|||
)
|
||||
else:
|
||||
if path == err_path:
|
||||
self.unknowns.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
"variable {0} is {1}, it will be ignored when loading from {2}"
|
||||
).format(
|
||||
|
|
@ -392,7 +382,7 @@ class UserDatas:
|
|||
)
|
||||
)
|
||||
else:
|
||||
self.unknowns.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
"family {0} is {1}, {2} will be ignored when loading from {3}"
|
||||
).format(
|
||||
|
|
@ -403,16 +393,16 @@ class UserDatas:
|
|||
)
|
||||
)
|
||||
else:
|
||||
self.unknowns.append(
|
||||
self.warnings.append(
|
||||
_("{0} in {1}").format(err, options["source"])
|
||||
)
|
||||
except LeadershipError as err:
|
||||
self.unknowns.append(_("{0} in {1}").format(err, options["source"]))
|
||||
self.warnings.append(_("{0} in {1}").format(err, options["source"]))
|
||||
except ValueError as err:
|
||||
err.prefix = ""
|
||||
if index is not None:
|
||||
type_ = option.type(translation=True)
|
||||
self.invalids.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'the value "{0}" is an invalid {1} for {2} at index "{3}", {4}, it will be ignored when loading from {5}'
|
||||
).format(
|
||||
|
|
@ -426,7 +416,7 @@ class UserDatas:
|
|||
)
|
||||
else:
|
||||
type_ = option.type(translation=True)
|
||||
self.invalids.append(
|
||||
self.warnings.append(
|
||||
_(
|
||||
'the value "{0}" is an invalid {1} for {2}, {3}, it will be ignored when loading from {4}'
|
||||
).format(
|
||||
|
|
|
|||
Loading…
Reference in a new issue