Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 843d72406b | |||
| 5a7b69472f | |||
| 360ce32d18 | |||
| 7d673766c8 |
5 changed files with 82 additions and 218 deletions
211
CHANGELOG.md
211
CHANGELOG.md
|
|
@ -1,205 +1,52 @@
|
||||||
## 0.1.0a27 (2026-06-15)
|
## 1.0.0 (2026-06-21)
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
|
|
||||||
## 0.1.0a26 (2026-06-11)
|
|
||||||
|
|
||||||
### Feat
|
### Feat
|
||||||
|
|
||||||
- leadership => sequence
|
- leadership => sequence
|
||||||
|
|
||||||
## 0.1.0a25 (2026-04-30)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- better path detection
|
|
||||||
|
|
||||||
## 0.1.0a24 (2025-12-30)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- add doc
|
- add doc
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
|
|
||||||
## 0.1.0a23 (2025-12-22)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
|
|
||||||
## 0.1.0a22 (2025-11-21)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- ExtentionError => ExtensionError
|
|
||||||
|
|
||||||
## 0.1.0a21 (2025-11-06)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- add some tests
|
- add some tests
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- always remove choice type + support warnings
|
|
||||||
|
|
||||||
## 0.1.0a20 (2025-11-03)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- allow extra kwargs
|
- allow extra kwargs
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
|
|
||||||
## 0.1.0a19 (2025-10-10)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
- tests
|
|
||||||
|
|
||||||
## 0.1.0a18 (2025-09-30)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- family or dynamic could needs type attribute
|
- family or dynamic could needs type attribute
|
||||||
|
|
||||||
## 0.1.0a17 (2025-09-29)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- param line size
|
- param line size
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- support numeric string
|
|
||||||
|
|
||||||
## 0.1.0a16 (2025-09-29)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- variable with an index is an integer variable
|
- variable with an index is an integer variable
|
||||||
- default value for a calculated variable with an unknown optional variable
|
- default value for a calculated variable with an unknown optional variable
|
||||||
- **#26**: convert cidr and network_cidr format
|
- **#26**: convert cidr and network_cidr format
|
||||||
- add integer type which will replace number type
|
- add integer type which will replace number type
|
||||||
|
|
||||||
## 0.1.0a15 (2025-09-22)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- dictionary => structure
|
|
||||||
|
|
||||||
## 0.1.0a14 (2025-06-18)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- rougail separation
|
|
||||||
|
|
||||||
## 0.1.0a13 (2025-05-15)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- no multi empty line when a variable finish by a multi line description
|
|
||||||
|
|
||||||
## 0.1.0a12 (2025-05-12)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- black
|
|
||||||
|
|
||||||
## 0.1.0a11 (2025-05-09)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- format with default_dictionary_format_version configuration
|
|
||||||
|
|
||||||
## 0.1.0a10 (2025-05-02)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- do not load use_data with rougail cli
|
|
||||||
- support {{ suffix }} name in 1.1 format version
|
|
||||||
|
|
||||||
## 0.1.0a9 (2025-04-30)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- add yamllint validation
|
- add yamllint validation
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
- add version
|
|
||||||
|
|
||||||
## 0.1.0a8 (2025-04-01)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- update tests
|
|
||||||
|
|
||||||
## 0.1.0a7 (2025-03-30)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- support multi lines for help
|
- support multi lines for help
|
||||||
|
|
||||||
## 0.1.0a6 (2025-03-28)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- do not add multi \n at ends of export
|
|
||||||
|
|
||||||
## 0.1.0a5 (2025-03-27)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- if and for in 3 lines
|
|
||||||
|
|
||||||
## 0.1.0a4 (2025-03-27)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- format jinja template
|
- format jinja template
|
||||||
|
|
||||||
## 0.1.0a3 (2025-03-27)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- add secret_manager support
|
- add secret_manager support
|
||||||
- add Namespace(Param|Calculation) support
|
- add Namespace(Param|Calculation) support
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- do not add namespace in param
|
|
||||||
- an empty variable is []
|
|
||||||
|
|
||||||
## 0.1.0a2 (2025-03-26)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- pyproject.toml
|
|
||||||
|
|
||||||
## 0.1.0a1 (2025-03-26)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- add pyproject.toml
|
|
||||||
|
|
||||||
## 0.1.0a0 (2025-02-10)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- output return status too
|
- output return status too
|
||||||
|
|
||||||
## 0.0.1a0 (2025-01-04)
|
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
||||||
|
- rougail dependencies
|
||||||
|
- black
|
||||||
|
- update tests
|
||||||
|
- better path detection
|
||||||
|
- update tests
|
||||||
|
- update tests
|
||||||
|
- ExtentionError => ExtensionError
|
||||||
|
- always remove choice type + support warnings
|
||||||
|
- update tests
|
||||||
|
- update tests
|
||||||
|
- tests
|
||||||
|
- support numeric string
|
||||||
|
- dictionary => structure
|
||||||
|
- rougail separation
|
||||||
|
- no multi empty line when a variable finish by a multi line description
|
||||||
|
- black
|
||||||
|
- format with default_dictionary_format_version configuration
|
||||||
|
- do not load use_data with rougail cli
|
||||||
|
- support {{ suffix }} name in 1.1 format version
|
||||||
|
- update tests
|
||||||
|
- add version
|
||||||
|
- update tests
|
||||||
|
- do not add multi \n at ends of export
|
||||||
|
- if and for in 3 lines
|
||||||
|
- do not add namespace in param
|
||||||
|
- an empty variable is []
|
||||||
|
- pyproject.toml
|
||||||
|
- add pyproject.toml
|
||||||
- remove prefix_path
|
- remove prefix_path
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail.output_formatter"
|
name = "rougail.output_formatter"
|
||||||
version = "0.1.0a27"
|
version = "1.0.0"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "Rougail output formatter"
|
description = "Rougail output formatter"
|
||||||
|
|
@ -24,8 +24,8 @@ classifiers = [
|
||||||
|
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rougail >= 1.1,<2",
|
"rougail >= 1.2.0,<2",
|
||||||
"djlint == 1.36.4",
|
"djlint == 1.39.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
|
|
||||||
|
|
@ -172,10 +172,16 @@ class RougailOutputFormatter:
|
||||||
filenames = self.rougailconfig["main_structural_directories"]
|
filenames = self.rougailconfig["main_structural_directories"]
|
||||||
extra = False
|
extra = False
|
||||||
if len(filenames) > 1:
|
if len(filenames) > 1:
|
||||||
raise ExtensionError(_('only one filename is allowed, not "{0}"').format(filenames))
|
raise ExtensionError(
|
||||||
|
_('only one filename is allowed, not "{0}"').format(filenames)
|
||||||
|
)
|
||||||
filename = Path(filenames[0])
|
filename = Path(filenames[0])
|
||||||
if not filename.is_file():
|
if not filename.is_file():
|
||||||
raise ExtensionError(_('"{0}" is not a valid file, but only a file is allowed').format(filename))
|
raise ExtensionError(
|
||||||
|
_('"{0}" is not a valid file, but only a file is allowed').format(
|
||||||
|
filename
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
self.version_name, self.original_yaml = RougailUpgrade(self.rougailconfig).run(
|
self.version_name, self.original_yaml = RougailUpgrade(self.rougailconfig).run(
|
||||||
filename
|
filename
|
||||||
|
|
@ -272,19 +278,19 @@ class RougailOutputFormatter:
|
||||||
for child_path in self.rougail.parents[path]:
|
for child_path in self.rougail.parents[path]:
|
||||||
child = self.rougail.objects
|
child = self.rougail.objects
|
||||||
if self.rougail.has_namespace:
|
if self.rougail.has_namespace:
|
||||||
split_path = child_path.split('.')[1:]
|
split_path = child_path.split(".")[1:]
|
||||||
else:
|
else:
|
||||||
split_path = child_path.split('.')
|
split_path = child_path.split(".")
|
||||||
for cpath in split_path:
|
for cpath in split_path:
|
||||||
if cpath not in child and '{{ identifier }}' in cpath:
|
if cpath not in child and "{{ identifier }}" in cpath:
|
||||||
# support format 1.0
|
# support format 1.0
|
||||||
if cpath.replace('{{ identifier }}', '') in child:
|
if cpath.replace("{{ identifier }}", "") in child:
|
||||||
cpath = cpath.replace('{{ identifier }}', '')
|
cpath = cpath.replace("{{ identifier }}", "")
|
||||||
elif cpath.replace('{{ identifier }}', '{{ suffix }}') in child:
|
elif cpath.replace("{{ identifier }}", "{{ suffix }}") in child:
|
||||||
cpath = cpath.replace('{{ identifier }}', '{{ suffix }}')
|
cpath = cpath.replace("{{ identifier }}", "{{ suffix }}")
|
||||||
child = child[cpath]
|
child = child[cpath]
|
||||||
tmp_family[cpath] = child
|
tmp_family[cpath] = child
|
||||||
#family_type = self.rougail.is_family_or_variable("", tmp_family, False, "")
|
# family_type = self.rougail.is_family_or_variable("", tmp_family, False, "")
|
||||||
collect = Collect(
|
collect = Collect(
|
||||||
self.rougail,
|
self.rougail,
|
||||||
name,
|
name,
|
||||||
|
|
@ -299,7 +305,7 @@ class RougailOutputFormatter:
|
||||||
if family_type == "family":
|
if family_type == "family":
|
||||||
family_type = collect.user_type
|
family_type = collect.user_type
|
||||||
if family_type is None:
|
if family_type is None:
|
||||||
family_type = 'family'
|
family_type = "family"
|
||||||
if family_type == type_:
|
if family_type == type_:
|
||||||
if "_type" in family:
|
if "_type" in family:
|
||||||
del family["_type"]
|
del family["_type"]
|
||||||
|
|
@ -346,26 +352,26 @@ class RougailOutputFormatter:
|
||||||
type_ = obj.type
|
type_ = obj.type
|
||||||
if type_ in RENAME_TYPE:
|
if type_ in RENAME_TYPE:
|
||||||
type_ = RENAME_TYPE[type_]
|
type_ = RENAME_TYPE[type_]
|
||||||
if type_ == 'cidr' or type_ == 'network_cidr':
|
if type_ == "cidr" or type_ == "network_cidr":
|
||||||
if type_ == 'cidr':
|
if type_ == "cidr":
|
||||||
type_ = 'ip'
|
type_ = "ip"
|
||||||
else:
|
else:
|
||||||
type_ = 'network'
|
type_ = "network"
|
||||||
if not obj.params:
|
if not obj.params:
|
||||||
obj.params = []
|
obj.params = []
|
||||||
key = 'cidr'
|
key = "cidr"
|
||||||
param = AnyParam(
|
param = AnyParam(
|
||||||
key='cidr',
|
key="cidr",
|
||||||
value=True,
|
value=True,
|
||||||
type="any",
|
type="any",
|
||||||
path=None,
|
path=None,
|
||||||
attribute=None,
|
attribute=None,
|
||||||
family_is_dynamic=None,
|
family_is_dynamic=None,
|
||||||
namespace=self.rougail.namespace,
|
namespace=self.rougail.namespace,
|
||||||
xmlfiles=obj.xmlfiles,
|
xmlfiles=obj.xmlfiles,
|
||||||
)
|
)
|
||||||
obj.params.append(param)
|
obj.params.append(param)
|
||||||
if type_ == 'choice':
|
if type_ == "choice":
|
||||||
variable_obj = self.rougail.choices
|
variable_obj = self.rougail.choices
|
||||||
elif type_ == "regexp":
|
elif type_ == "regexp":
|
||||||
variable_obj = self.rougail.regexp
|
variable_obj = self.rougail.regexp
|
||||||
|
|
@ -385,7 +391,9 @@ class RougailOutputFormatter:
|
||||||
continue
|
continue
|
||||||
value = self.object_to_yaml(attr, type_, value, multi, path)
|
value = self.object_to_yaml(attr, type_, value, multi, path)
|
||||||
if isinstance(value, dict) and "identifier" in value:
|
if isinstance(value, dict) and "identifier" in value:
|
||||||
value["identifier"] = self.object_to_yaml("identifier", type_, value["identifier"], True, path)
|
value["identifier"] = self.object_to_yaml(
|
||||||
|
"identifier", type_, value["identifier"], True, path
|
||||||
|
)
|
||||||
variable[attr] = value
|
variable[attr] = value
|
||||||
if variable.get("mandatory") is True and None not in variable.get(
|
if variable.get("mandatory") is True and None not in variable.get(
|
||||||
"choices", []
|
"choices", []
|
||||||
|
|
@ -395,14 +403,20 @@ class RougailOutputFormatter:
|
||||||
if isinstance(obj.default, VariableCalculation):
|
if isinstance(obj.default, VariableCalculation):
|
||||||
is_multi = "multi" in variable and variable["multi"] is True
|
is_multi = "multi" in variable and variable["multi"] is True
|
||||||
if "type" in variable or is_multi:
|
if "type" in variable or is_multi:
|
||||||
other_path = self.rougail.paths.get_full_path(obj.default.variable, path)
|
other_path = self.rougail.paths.get_full_path(
|
||||||
|
obj.default.variable, path
|
||||||
|
)
|
||||||
if other_path in self.rougail.paths:
|
if other_path in self.rougail.paths:
|
||||||
other_obj = self.rougail.paths[other_path]
|
other_obj = self.rougail.paths[other_path]
|
||||||
if "type" in variable and variable["type"] == other_obj.type:
|
if "type" in variable and variable["type"] == other_obj.type:
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
if is_multi and obj.multi:
|
if is_multi and obj.multi:
|
||||||
del variable["multi"]
|
del variable["multi"]
|
||||||
if "type" in variable and isinstance(obj.default, IndexCalculation) and variable["type"] == "integer":
|
if (
|
||||||
|
"type" in variable
|
||||||
|
and isinstance(obj.default, IndexCalculation)
|
||||||
|
and variable["type"] == "integer"
|
||||||
|
):
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
if "type" in variable and variable["type"] in [
|
if "type" in variable and variable["type"] in [
|
||||||
"string",
|
"string",
|
||||||
|
|
@ -555,7 +569,9 @@ class RougailOutputFormatter:
|
||||||
jinja["return_type"] = return_type
|
jinja["return_type"] = return_type
|
||||||
if value.description:
|
if value.description:
|
||||||
if "\n" in value.description:
|
if "\n" in value.description:
|
||||||
jinja["description"] = LiteralScalarString(value.description.strip())
|
jinja["description"] = LiteralScalarString(
|
||||||
|
value.description.strip()
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
jinja["description"] = value.description.strip()
|
jinja["description"] = value.description.strip()
|
||||||
if value.warnings:
|
if value.warnings:
|
||||||
|
|
@ -598,7 +614,9 @@ class RougailOutputFormatter:
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
if value.description:
|
if value.description:
|
||||||
if "\n" in value.description:
|
if "\n" in value.description:
|
||||||
variable["description"] = LiteralScalarString(value.description.strip())
|
variable["description"] = LiteralScalarString(
|
||||||
|
value.description.strip()
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
variable["description"] = value.description.strip()
|
variable["description"] = value.description.strip()
|
||||||
return variable
|
return variable
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.1.0a27"
|
__version__ = "1.0.0"
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,3 @@ t = translation(
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = t.gettext
|
_ = t.gettext
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue