Compare commits
No commits in common. "5ff71c5ecbc6e9422e5e9ddf9d99d8be130b1731" and "4660a653032c63ddeb7602a52b850dd566c51b23" have entirely different histories.
5ff71c5ecb
...
4660a65303
279 changed files with 63 additions and 1106 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -1,13 +0,0 @@
|
|||
## 1.0.2 (2024-01-28)
|
||||
|
||||
### Fix
|
||||
|
||||
- 2023 => 2024
|
||||
- correction for calculated variable with a variable in a dynamic family
|
||||
|
||||
## 1.0.1 (2024-01-28)
|
||||
|
||||
### Feat
|
||||
|
||||
- documentation
|
||||
- new format 1.0
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
[build-system]
|
||||
build-backend = "flit_core.buildapi"
|
||||
requires = ["flit_core >=3.8.0,<4"]
|
||||
|
||||
[project]
|
||||
name = "rougail"
|
||||
version = "1.0.2"
|
||||
authors = [
|
||||
{name = "Emmanuel Garette", email = "gnunux@gnunux.info"},
|
||||
]
|
||||
description = "A consistency handling system that was initially designed in the configuration management"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
classifiers = [
|
||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Operating System :: OS Independent",
|
||||
"Natural Language :: English",
|
||||
"Natural Language :: French",
|
||||
|
||||
]
|
||||
dependencies = [
|
||||
"pyyaml ~= 6.0.1",
|
||||
"pydantic ~= 2.5.2",
|
||||
"jinja2 ~= 3.1.2",
|
||||
]
|
||||
[project.optional-dependancies]
|
||||
dev = [
|
||||
"pylint ~= 3.0.3",
|
||||
]
|
||||
|
||||
[tool.commitizen]
|
||||
name = "cz_conventional_commits"
|
||||
tag_format = "$version"
|
||||
version_scheme = "semver"
|
||||
version_provider = "pep621"
|
||||
update_changelog_on_bump = true
|
||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
@ -47,7 +47,6 @@ import logging
|
|||
from pathlib import Path
|
||||
from typing import Optional, Union, get_type_hints, Any, Literal, List, Dict, Iterator, Tuple
|
||||
from itertools import chain
|
||||
from re import findall
|
||||
|
||||
from yaml import safe_load
|
||||
from pydantic import ValidationError
|
||||
|
|
@ -125,28 +124,9 @@ class Paths:
|
|||
) -> Any:
|
||||
suffix = None
|
||||
dynamic_path = None
|
||||
dynamic_variable_path = None
|
||||
if not path in self._data:
|
||||
for dynamic in self._dynamics:
|
||||
if "{{ suffix }}" in dynamic:
|
||||
regexp = "^" + dynamic.replace('{{ suffix }}', '(.*)') + '.'
|
||||
finded = findall(regexp, path)
|
||||
if len(finded) != 1:
|
||||
continue
|
||||
splitted_dynamic = dynamic.split('.')
|
||||
splitted_path = path.split('.')
|
||||
for idx, s in enumerate(splitted_dynamic):
|
||||
if '{{ suffix }}' in s:
|
||||
break
|
||||
|
||||
suffix_path = '.'.join(splitted_path[idx + 1:])
|
||||
if suffix_path:
|
||||
suffix_path = "." + suffix_path
|
||||
suffix = splitted_path[idx] + suffix_path
|
||||
dynamic_path = dynamic
|
||||
dynamic_variable_path = dynamic + suffix_path
|
||||
break
|
||||
elif path.startswith(dynamic):
|
||||
if path.startswith(dynamic):
|
||||
subpaths = path[len(dynamic) :].split(".", 1)
|
||||
if (
|
||||
subpaths[0]
|
||||
|
|
@ -156,16 +136,15 @@ class Paths:
|
|||
suffix = (
|
||||
dynamic.rsplit(".", 1)[-1] + subpaths[0] + "." + subpaths[1]
|
||||
)
|
||||
dynamic_path = dynamic
|
||||
dynamic_variable_path = dynamic + "." + subpaths[1]
|
||||
dynamic_path = dynamic + "." + subpaths[1]
|
||||
break
|
||||
if suffix:
|
||||
break
|
||||
if suffix is None and not path in self._data:
|
||||
return None, None, None
|
||||
dynamic = None
|
||||
if suffix and dynamic_variable_path:
|
||||
path = dynamic_variable_path
|
||||
dynamic = self._data[dynamic_path]
|
||||
return self._data[path], suffix, dynamic
|
||||
return None, None
|
||||
if suffix and dynamic_path:
|
||||
path = dynamic_path
|
||||
return self._data[path], suffix
|
||||
|
||||
def __getitem__(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""Rougail object model
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2023-2024
|
||||
Copyright (C) 2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class Calculation(BaseModel):
|
|||
param = param_obj.model_dump()
|
||||
if param.get("type") == "variable":
|
||||
variable_path = self.get_realpath(param["variable"])
|
||||
variable, suffix, dynamic = objectspace.paths.get_with_dynamic(variable_path)
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(variable_path)
|
||||
if not variable:
|
||||
if not param.get("optional"):
|
||||
raise Exception(f"cannot find {variable_path}")
|
||||
|
|
@ -95,7 +95,6 @@ class Calculation(BaseModel):
|
|||
param["variable"] = variable
|
||||
if suffix:
|
||||
param["suffix"] = suffix
|
||||
param["dynamic"] = dynamic
|
||||
if param.get("type") == "information":
|
||||
if param["variable"]:
|
||||
variable_path = self.get_realpath(param["variable"])
|
||||
|
|
@ -148,7 +147,7 @@ class JinjaCalculation(Calculation):
|
|||
default["params"] |= self.get_params(objectspace)
|
||||
if params:
|
||||
default["params"] |= params
|
||||
for sub_variable, suffix, true_path, dynamic in get_jinja_variable_to_param(
|
||||
for sub_variable, suffix, true_path in get_jinja_variable_to_param(
|
||||
self.jinja,
|
||||
objectspace,
|
||||
variable.xmlfiles,
|
||||
|
|
@ -162,7 +161,6 @@ class JinjaCalculation(Calculation):
|
|||
}
|
||||
if suffix:
|
||||
default["params"][true_path]["suffix"] = suffix
|
||||
default["params"][true_path]["dynamic"] = dynamic
|
||||
return default
|
||||
|
||||
def to_function(
|
||||
|
|
@ -232,7 +230,7 @@ class VariableCalculation(Calculation):
|
|||
objectspace,
|
||||
) -> dict:
|
||||
variable_path = self.get_realpath(self.variable)
|
||||
variable, suffix, dynamic = objectspace.paths.get_with_dynamic(variable_path)
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(variable_path)
|
||||
if not variable:
|
||||
raise Exception(f"pffff {variable_path}")
|
||||
if not isinstance(variable, objectspace.variable):
|
||||
|
|
@ -244,7 +242,6 @@ class VariableCalculation(Calculation):
|
|||
}
|
||||
if suffix:
|
||||
param["suffix"] = suffix
|
||||
param["dynamic"] = dynamic
|
||||
params = {None: [param]}
|
||||
function = "calc_value"
|
||||
help_function = None
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
@ -393,7 +393,6 @@ class Common:
|
|||
param["variable"],
|
||||
param.get("propertyerror", True),
|
||||
param.get("suffix"),
|
||||
param.get("dynamic"),
|
||||
)
|
||||
if param["type"] == "any":
|
||||
if isinstance(param["value"], str):
|
||||
|
|
@ -408,7 +407,6 @@ class Common:
|
|||
param,
|
||||
propertyerror,
|
||||
suffix: Optional[str],
|
||||
dynamic,
|
||||
) -> str:
|
||||
"""build variable parameters"""
|
||||
if param.path == self.elt.path:
|
||||
|
|
@ -419,7 +417,7 @@ class Common:
|
|||
params = [f"{option_name}"]
|
||||
if suffix is not None:
|
||||
param_type = "ParamDynOption"
|
||||
family = self.tiramisu.reflector_objects[dynamic.path].get(
|
||||
family = self.tiramisu.reflector_objects[param.path.rsplit(".", 1)[0]].get(
|
||||
self.calls, self.elt.path
|
||||
)
|
||||
params.extend([f"'{suffix}'", f"{family}"])
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
|||
Copyright (C) 2019-2021
|
||||
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2022-2024
|
||||
Copyright (C) 2022-2023
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
|
|
@ -112,8 +112,8 @@ def get_jinja_variable_to_param(
|
|||
variables = list(variables)
|
||||
variables.sort()
|
||||
for variable_path in variables:
|
||||
variable, suffix, dynamic = objectspace.paths.get_with_dynamic(
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(
|
||||
get_realpath(variable_path, path_prefix)
|
||||
)
|
||||
if variable and variable.path in objectspace.variables:
|
||||
yield variable, suffix, variable_path, dynamic
|
||||
yield variable, suffix, variable_path
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
["rougail.empty"]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
["rougail.general.adresse_ip_eth0", "rougail.general.adresse_netmask_eth0", "rougail.general.adresse_ip"]
|
||||
|
|
@ -1 +0,0 @@
|
|||
["rougail.general.adresse_ip_eth0", "rougail.general.adresse_ip"]
|
||||
|
|
@ -1 +0,0 @@
|
|||
["rougail.general.adresse_ip_eth0", "rougail.general.adresse_netmask_eth0"]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
["rougail.general.leader.leader"]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue