Compare commits
44 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51be10e39f | |||
| ddecd9d4e3 | |||
| 8bb9bb7e16 | |||
| f83b395f77 | |||
| 9dad912ab3 | |||
| 61dc196e85 | |||
| 8cf9143430 | |||
| 5fda2da0ba | |||
| f422e0a801 | |||
| f40becb2ce | |||
| aa144c1e7c | |||
| 7e803a5a41 | |||
| d54db472e1 | |||
| 4e2caf15ab | |||
| 1af2120452 | |||
| 881cdea72b | |||
| 7ce8559481 | |||
| 7552a1ab18 | |||
| d75e447ec9 | |||
| 6824ce4190 | |||
| f0b5cf3367 | |||
| 26ae0b4e76 | |||
| 7dfb0465e5 | |||
| a2787fd7f2 | |||
| acfca4f6a5 | |||
| 64acbc2dbd | |||
| 6598aff220 | |||
| a7c35b2de9 | |||
| 8e8989c858 | |||
| f8bf91fd7a | |||
| d2c79690e4 | |||
| 076fb40bdd | |||
| d2a8a601d8 | |||
| 39358a74b5 | |||
| bc89583fe4 | |||
| 634fdb6a3d | |||
| 01a86922bd | |||
| fa039c1743 | |||
| d4f81987e6 | |||
| b0fdef7a52 | |||
| 586f3a3e91 | |||
| 23eadd9269 | |||
| 412831278d | |||
| 46db478687 |
1536 changed files with 12764 additions and 3887 deletions
119
CHANGELOG.md
119
CHANGELOG.md
|
|
@ -1,3 +1,122 @@
|
||||||
|
## 0.2.0a16 (2025-11-21)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add 'add_help' option un TiramisuCmdLineParser + -ff => -yf
|
||||||
|
|
||||||
|
## 0.2.0a15 (2025-11-06)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update tests
|
||||||
|
- unknown variable
|
||||||
|
|
||||||
|
## 0.2.0a14 (2025-10-10)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update test
|
||||||
|
- tests
|
||||||
|
- tests for formatter
|
||||||
|
|
||||||
|
## 0.2.0a13 (2025-09-29)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- default value for a calculated variable with an unknown optional variable
|
||||||
|
- update tests for integer type
|
||||||
|
|
||||||
|
## 0.2.0a12 (2025-09-22)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- dependency
|
||||||
|
|
||||||
|
## 0.2.0a11 (2025-05-26)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- do not load yaml has YAML object
|
||||||
|
|
||||||
|
## 0.2.0a10 (2025-05-14)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- yaml.filename could be the name of a directory
|
||||||
|
|
||||||
|
## 0.2.0a9 (2025-05-12)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- black
|
||||||
|
- update translation
|
||||||
|
- load file with order
|
||||||
|
|
||||||
|
## 0.2.0a8 (2025-05-02)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- do not force use_data usage
|
||||||
|
|
||||||
|
## 0.2.0a7 (2025-04-30)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update tests
|
||||||
|
|
||||||
|
## 0.2.0a6 (2025-04-09)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- version
|
||||||
|
|
||||||
|
## 0.2.0a5 (2025-04-09)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- better error message
|
||||||
|
|
||||||
|
## 0.2.0a4 (2025-04-01)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update tests
|
||||||
|
|
||||||
|
## 0.2.0a3 (2025-03-30)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- i18n
|
||||||
|
|
||||||
|
## 0.2.0a2 (2025-03-30)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update tests
|
||||||
|
- update tests, some errors are now in warnings level
|
||||||
|
|
||||||
|
## 0.2.0a1 (2025-02-10)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- add new parameter yaml.file_with_secrets
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update tests
|
||||||
|
|
||||||
|
## 0.2.0a0 (2024-12-11)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- rename file to yaml
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- prepare ansible user data
|
||||||
|
|
||||||
|
## 0.1.0 (2024-11-06)
|
||||||
|
|
||||||
## 0.1.0rc1 (2024-11-06)
|
## 0.1.0rc1 (2024-11-06)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
# rougail-user-data
|
# rougail-user-data-yaml
|
||||||
|
|
||||||
|
|
|
||||||
51
locale/fr/LC_MESSAGES/rougail_user_data_yaml.po
Normal file
51
locale/fr/LC_MESSAGES/rougail_user_data_yaml.po
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR ORGANIZATION
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: 2025-05-14 08:28+0200\n"
|
||||||
|
"PO-Revision-Date: 2025-05-14 08:29+0200\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: fr\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
|
"X-Generator: Poedit 3.5\n"
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:46
|
||||||
|
msgid "yaml is not set in step.user_data"
|
||||||
|
msgstr "\"yaml\" n'est pas défini dans step.user_data"
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:72
|
||||||
|
msgid "cannot load \"{0}\", the root value is not a dict but \"{1}\""
|
||||||
|
msgstr ""
|
||||||
|
"ne peut charger \"{0}\", la valeur racine n'est pas une dictionnaire mais "
|
||||||
|
"\"{1}\""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:95
|
||||||
|
msgid "the YAML file \"{0}\""
|
||||||
|
msgstr "le fichier YAML \"{0}\""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:127
|
||||||
|
msgid "\"{0}\" in {1} has an unknown value"
|
||||||
|
msgstr "\"{0}\" dans {1} a une valeur inconnue"
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/config.py:30
|
||||||
|
msgid "Configuration rougail-user-data-yaml"
|
||||||
|
msgstr "Configuration de rougail-user-data-yaml"
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/config.py:39
|
||||||
|
msgid "File or directory name where user datas are stored"
|
||||||
|
msgstr ""
|
||||||
|
"Nom du fichier ou répertoire où sont enregistré les données utilisateur"
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/config.py:48
|
||||||
|
msgid "File that may contain secrets"
|
||||||
|
msgstr "Le fichier peut contenir des secrets"
|
||||||
|
|
||||||
|
#~ msgid "Filename"
|
||||||
|
#~ msgstr "Nom du fichier"
|
||||||
Binary file not shown.
|
|
@ -1,35 +0,0 @@
|
||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR ORGANIZATION
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: \n"
|
|
||||||
"POT-Creation-Date: 2024-11-01 12:12+0100\n"
|
|
||||||
"PO-Revision-Date: 2024-11-01 12:13+0100\n"
|
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"Language: fr\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
|
||||||
"X-Generator: Poedit 3.5\n"
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:40
|
|
||||||
msgid "file is not set in step.user_data"
|
|
||||||
msgstr "\"file\" n'est pas défini dans step.user_data"
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:58
|
|
||||||
msgid "cannot load \"{0}\", the root value is not a dict but \"{1}\""
|
|
||||||
msgstr ""
|
|
||||||
"ne peut charger \"{0}\", la valeur racine n'est pas une dictionnaire mais "
|
|
||||||
"\"{1}\""
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:66
|
|
||||||
msgid "file ({0})"
|
|
||||||
msgstr "fichier ({0})"
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:88
|
|
||||||
msgid "\"{0}\" in {1} has an unknown value"
|
|
||||||
msgstr "\"{0}\" dans {1} a une valeur inconnue"
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR ORGANIZATION
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"POT-Creation-Date: 2024-11-01 12:13+0100\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
|
||||||
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:40
|
|
||||||
msgid "file is not set in step.user_data"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:58
|
|
||||||
msgid "cannot load \"{0}\", the root value is not a dict but \"{1}\""
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:66
|
|
||||||
msgid "file ({0})"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/rougail/user_data_file/__init__.py:88
|
|
||||||
msgid "\"{0}\" in {1} has an unknown value"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
45
locale/rougail_user_data_yaml.pot
Normal file
45
locale/rougail_user_data_yaml.pot
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR ORGANIZATION
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"POT-Creation-Date: 2025-05-14 08:29+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
|
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:46
|
||||||
|
msgid "yaml is not set in step.user_data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:72
|
||||||
|
msgid "cannot load \"{0}\", the root value is not a dict but \"{1}\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:95
|
||||||
|
msgid "the YAML file \"{0}\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/__init__.py:127
|
||||||
|
msgid "\"{0}\" in {1} has an unknown value"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/config.py:30
|
||||||
|
msgid "Configuration rougail-user-data-yaml"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/config.py:39
|
||||||
|
msgid "File or directory name where user datas are stored"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/rougail/user_data_yaml/config.py:48
|
||||||
|
msgid "File that may contain secrets"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
@ -3,21 +3,20 @@ build-backend = "flit_core.buildapi"
|
||||||
requires = ["flit_core >=3.8.0,<4"]
|
requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail.user_data_file"
|
name = "rougail.user_data_yaml"
|
||||||
version = "0.1.0"
|
version = "0.2.0a16"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "Rougail user_data file"
|
description = "Rougail user_data yaml"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
license = {file = "LICENSE"}
|
license = {file = "LICENSE"}
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
|
"Programming Language :: Python :: 3.14",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
|
|
@ -25,16 +24,21 @@ classifiers = [
|
||||||
|
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rougail >= 1.1,<2",
|
"rougail-base >= 1.1,<2",
|
||||||
|
"ruamel.yaml ~= 0.18.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-file"
|
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-yaml"
|
||||||
|
|
||||||
[tool.commitizen]
|
[tool.commitizen]
|
||||||
name = "cz_conventional_commits"
|
name = "cz_conventional_commits"
|
||||||
tag_format = "$version"
|
tag_format = "$version"
|
||||||
version_scheme = "pep440"
|
version_scheme = "pep440"
|
||||||
version_provider = "pep621"
|
version_provider = "pep621"
|
||||||
#update_changelog_on_bump = true
|
version_files = [
|
||||||
|
"src/rougail/user_data_yaml/__version__.py",
|
||||||
|
"pyproject.toml:version"
|
||||||
|
]
|
||||||
|
update_changelog_on_bump = true
|
||||||
changelog_merge_prerelease = true
|
changelog_merge_prerelease = true
|
||||||
|
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
||||||
"""
|
|
||||||
Silique (https://www.silique.fr)
|
|
||||||
Copyright (C) 2024
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from rougail import RougailConfig
|
|
||||||
from ruamel.yaml import YAML
|
|
||||||
from tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError
|
|
||||||
|
|
||||||
from .i18n import _
|
|
||||||
|
|
||||||
|
|
||||||
class RougailUserDataFile:
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
config,
|
|
||||||
*,
|
|
||||||
rougailconfig=None,
|
|
||||||
) -> None:
|
|
||||||
if rougailconfig is None:
|
|
||||||
rougailconfig = RougailConfig
|
|
||||||
user_data = rougailconfig["step.user_data"]
|
|
||||||
if "file" not in user_data:
|
|
||||||
user_data.append("file")
|
|
||||||
rougailconfig["step.user_data"] = user_data
|
|
||||||
user_data = rougailconfig["step.user_data"]
|
|
||||||
if "file" not in user_data:
|
|
||||||
raise Exception(_("file is not set in step.user_data"))
|
|
||||||
self.rougailconfig = rougailconfig
|
|
||||||
self.filenames = self.rougailconfig["file.filename"]
|
|
||||||
self.yaml = YAML()
|
|
||||||
self.config = config
|
|
||||||
self.errors = []
|
|
||||||
self.warnings = []
|
|
||||||
|
|
||||||
def run(
|
|
||||||
self,
|
|
||||||
) -> None:
|
|
||||||
user_datas = []
|
|
||||||
for filename in self.filenames:
|
|
||||||
with open(filename) as fh_config:
|
|
||||||
file_values = self.yaml.load(fh_config)
|
|
||||||
if not file_values:
|
|
||||||
continue
|
|
||||||
if not isinstance(file_values, dict):
|
|
||||||
self.errors.append(
|
|
||||||
_(
|
|
||||||
'cannot load "{0}", the root value is not a dict but "{1}"'
|
|
||||||
).format(filename, file_values)
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
values = {}
|
|
||||||
self.parse(
|
|
||||||
values,
|
|
||||||
"",
|
|
||||||
file_values,
|
|
||||||
filename,
|
|
||||||
)
|
|
||||||
user_datas.append(
|
|
||||||
{
|
|
||||||
"source": _("file ({0})").format(filename),
|
|
||||||
"errors": self.errors,
|
|
||||||
"warnings": self.warnings,
|
|
||||||
"values": values,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return user_datas
|
|
||||||
|
|
||||||
def parse(
|
|
||||||
self,
|
|
||||||
values: dict,
|
|
||||||
parent_path: str,
|
|
||||||
file_values: dict,
|
|
||||||
filename: str,
|
|
||||||
):
|
|
||||||
for key, value in file_values.items():
|
|
||||||
path = parent_path + key
|
|
||||||
if isinstance(value, dict):
|
|
||||||
self.parse(values, path + ".", value, filename)
|
|
||||||
elif isinstance(value, list) and value and isinstance(value[0], dict):
|
|
||||||
# it's a leadership
|
|
||||||
keys = set()
|
|
||||||
for val in value:
|
|
||||||
if not isinstance(val, dict):
|
|
||||||
self.errors.append(
|
|
||||||
_('"{0}" in {1} has an unknown value').format(
|
|
||||||
path, filename
|
|
||||||
)
|
|
||||||
)
|
|
||||||
break
|
|
||||||
keys |= set(val)
|
|
||||||
else:
|
|
||||||
for val in value:
|
|
||||||
for key in keys:
|
|
||||||
values.setdefault(path + "." + key, []).append(
|
|
||||||
val.get(key, None)
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
|
||||||
values[path] = value
|
|
||||||
|
|
||||||
|
|
||||||
RougailUserData = RougailUserDataFile
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("RougailUserDataFile",)
|
|
||||||
Binary file not shown.
149
src/rougail/user_data_yaml/__init__.py
Normal file
149
src/rougail/user_data_yaml/__init__.py
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
"""
|
||||||
|
Silique (https://www.silique.fr)
|
||||||
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from rougail.error import ExtensionError
|
||||||
|
from tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError
|
||||||
|
|
||||||
|
from .i18n import _
|
||||||
|
from .__version__ import __version__
|
||||||
|
|
||||||
|
|
||||||
|
class RougailUserDataYaml:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
config,
|
||||||
|
*,
|
||||||
|
rougailconfig=None,
|
||||||
|
) -> None:
|
||||||
|
if rougailconfig is None:
|
||||||
|
from rougail import RougailConfig
|
||||||
|
|
||||||
|
rougailconfig = RougailConfig
|
||||||
|
user_data = rougailconfig["step.user_data"]
|
||||||
|
if "yaml" not in user_data:
|
||||||
|
user_data.append("yaml")
|
||||||
|
rougailconfig["step.user_data"] = user_data
|
||||||
|
user_data = rougailconfig["step.user_data"]
|
||||||
|
if "yaml" not in user_data:
|
||||||
|
raise ExtensionError(_("yaml is not set in step.user_data"))
|
||||||
|
self.rougailconfig = rougailconfig
|
||||||
|
self.filenames = self.rougailconfig["yaml.filename"]
|
||||||
|
self.file_with_secrets = self.rougailconfig["yaml.file_with_secrets"]
|
||||||
|
self.config = config
|
||||||
|
self.errors = []
|
||||||
|
self.warnings = []
|
||||||
|
|
||||||
|
def run(
|
||||||
|
self,
|
||||||
|
) -> None:
|
||||||
|
self.yaml = YAML(typ='safe', pure=True)
|
||||||
|
user_datas = []
|
||||||
|
if self.file_with_secrets == "last":
|
||||||
|
last_filename_idx = len(self.filenames) - 1
|
||||||
|
for idx, filename in enumerate(self.filenames):
|
||||||
|
filename = Path(filename)
|
||||||
|
if filename.is_file():
|
||||||
|
filenames = [filename]
|
||||||
|
else:
|
||||||
|
filenames = list(filename.glob('*.yml')) + list(filename.glob('*.yaml'))
|
||||||
|
for filename in sorted(filenames):
|
||||||
|
file_values = self.open(filename)
|
||||||
|
if not file_values:
|
||||||
|
continue
|
||||||
|
values = {}
|
||||||
|
if not isinstance(file_values, dict):
|
||||||
|
self.errors.append(
|
||||||
|
_(
|
||||||
|
'cannot load "{0}", the root value is not a dict but "{1}"'
|
||||||
|
).format(filename, file_values)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.parse(
|
||||||
|
values,
|
||||||
|
"",
|
||||||
|
file_values,
|
||||||
|
filename,
|
||||||
|
)
|
||||||
|
if self.file_with_secrets == "none":
|
||||||
|
allow_secrets_variables = False
|
||||||
|
elif self.file_with_secrets == "first":
|
||||||
|
allow_secrets_variables = idx == 0
|
||||||
|
elif self.file_with_secrets == "last":
|
||||||
|
allow_secrets_variables = idx == last_filename_idx
|
||||||
|
else:
|
||||||
|
allow_secrets_variables = True
|
||||||
|
user_datas.append(
|
||||||
|
{
|
||||||
|
"source": _('the YAML file "{0}"').format(filename),
|
||||||
|
"errors": self.errors,
|
||||||
|
"warnings": self.warnings,
|
||||||
|
"values": values,
|
||||||
|
"options": {
|
||||||
|
"allow_secrets_variables": allow_secrets_variables,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return user_datas
|
||||||
|
|
||||||
|
def open(self, filename: str) -> dict:
|
||||||
|
with filename.open() as fh_config:
|
||||||
|
return self.yaml.load(fh_config)
|
||||||
|
|
||||||
|
def parse(
|
||||||
|
self,
|
||||||
|
values: dict,
|
||||||
|
parent_path: str,
|
||||||
|
file_values: dict,
|
||||||
|
filename: str,
|
||||||
|
):
|
||||||
|
for key, value in file_values.items():
|
||||||
|
path = parent_path + key
|
||||||
|
if isinstance(value, dict):
|
||||||
|
self.parse(values, path + ".", value, filename)
|
||||||
|
elif isinstance(value, list) and value and isinstance(value[0], dict):
|
||||||
|
# it's a leadership
|
||||||
|
keys = []
|
||||||
|
for val in value:
|
||||||
|
if not isinstance(val, dict):
|
||||||
|
self.errors.append(
|
||||||
|
_('"{0}" in {1} has an unknown value').format(
|
||||||
|
path, filename
|
||||||
|
)
|
||||||
|
)
|
||||||
|
break
|
||||||
|
for v in val:
|
||||||
|
if v not in keys:
|
||||||
|
keys.append(v)
|
||||||
|
else:
|
||||||
|
for val in value:
|
||||||
|
for key in keys:
|
||||||
|
values.setdefault(path + "." + key, []).append(
|
||||||
|
val.get(key, None)
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
values[path] = value
|
||||||
|
|
||||||
|
|
||||||
|
RougailUserData = RougailUserDataYaml
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ("RougailUserDataYaml",)
|
||||||
1
src/rougail/user_data_yaml/__version__.py
Normal file
1
src/rougail/user_data_yaml/__version__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
__version__ = "0.2.0a16"
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"""
|
"""
|
||||||
Config file for Rougail-user-data
|
Config yaml for Rougail-user-data
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -18,33 +18,42 @@ You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
def get_rougail_config(
|
def get_rougail_config(
|
||||||
*,
|
*,
|
||||||
backward_compatibility=True,
|
backward_compatibility=True,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
options = """
|
options = f"""
|
||||||
file:
|
yaml:
|
||||||
description: Configuration rougail-user-data-file
|
description: {_("Configuration rougail-user-data-yaml")}
|
||||||
disabled:
|
disabled:
|
||||||
type: jinja
|
|
||||||
jinja: |
|
jinja: |
|
||||||
{% if 'file' not in step.user_data %}
|
{{% if step.user_data is propertyerror or 'yaml' not in step.user_data %}}
|
||||||
disabled
|
disabled
|
||||||
{% endif %}
|
{{% endif %}}
|
||||||
|
|
||||||
filename:
|
filename:
|
||||||
description: Filename with user data
|
description: {_("File or directory name where user datas are stored")}
|
||||||
alternative_name: ff
|
alternative_name: yf
|
||||||
type: unix_filename
|
type: unix_filename
|
||||||
multi: true
|
multi: true
|
||||||
params:
|
params:
|
||||||
allow_relative: True
|
allow_relative: True
|
||||||
test_existence: True
|
test_existence: True
|
||||||
types:
|
|
||||||
- file
|
file_with_secrets:
|
||||||
|
description: {_("File that may contain secrets")}
|
||||||
|
default: all
|
||||||
|
choices:
|
||||||
|
- all
|
||||||
|
- first
|
||||||
|
- last
|
||||||
|
- none
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
"name": "file",
|
"name": "yaml",
|
||||||
"process": "user data",
|
"process": "user data",
|
||||||
"options": options,
|
"options": options,
|
||||||
"level": 50,
|
"level": 50,
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""Internationalisation utilities
|
"""Internationalisation utilities
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -20,7 +20,7 @@ from gettext import translation
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
t = translation(
|
t = translation(
|
||||||
"rougail_user_data_file", str(Path(__file__).parent / "locale"), fallback=True
|
"rougail_user_data_yaml", str(Path(__file__).parent / "locale"), fallback=True
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = t.gettext
|
_ = t.gettext
|
||||||
Binary file not shown.
5
tests/directory/result.txt
Normal file
5
tests/directory/result.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variable1": "value1",
|
||||||
|
"variable2": "value2",
|
||||||
|
"variable3": null
|
||||||
|
}
|
||||||
11
tests/directory/structure/rougail/file.yaml
Normal file
11
tests/directory/structure/rougail/file.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
variable1:
|
||||||
|
mandatory: false
|
||||||
|
|
||||||
|
variable2:
|
||||||
|
mandatory: false
|
||||||
|
|
||||||
|
variable3:
|
||||||
|
mandatory: false
|
||||||
2
tests/directory/yaml/file1.txt
Normal file
2
tests/directory/yaml/file1.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
variable3: value3
|
||||||
2
tests/directory/yaml/file1.yaml
Normal file
2
tests/directory/yaml/file1.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
variable2: value2
|
||||||
2
tests/directory/yaml/file1.yml
Normal file
2
tests/directory/yaml/file1.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
variable1: value1
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"dynVal1": {
|
||||||
|
"var": "string1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
version: '1.1'
|
||||||
|
|
||||||
|
var: [] # A suffix variable
|
||||||
|
|
||||||
|
"dyn{{ identifier }}":
|
||||||
|
description: A dynamic family
|
||||||
|
dynamic:
|
||||||
|
variable: _.var
|
||||||
|
var: # A dynamic variable
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"dynVal1": {
|
||||||
|
"var": "string1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
version: '1.1'
|
||||||
|
|
||||||
|
var: #A suffix variable
|
||||||
|
mandatory: false
|
||||||
|
default: []
|
||||||
|
|
||||||
|
"dyn{{ identifier }}":
|
||||||
|
description: A dynamic family
|
||||||
|
dynamic:
|
||||||
|
variable: _.var
|
||||||
|
var: # A dynamic variable
|
||||||
6
tests/errors/results/00_unknown_variable.yaml
Normal file
6
tests/errors/results/00_unknown_variable.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"unknown\" does not exist, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/00_unknown_variable.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
7
tests/errors/results/01_disabled_family.yaml
Normal file
7
tests/errors/results/01_disabled_family.yaml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"family \"family_disabled\" is disabled, \"family_disabled.variable1\" will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_disabled_family.yaml\"",
|
||||||
|
"family \"family_disabled\" is disabled, \"family_disabled.variable2\" will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_disabled_family.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/01_disabled_variable.yaml
Normal file
6
tests/errors/results/01_disabled_variable.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable \"variable_disabled\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_disabled_variable.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/01_wrong_type.yaml
Normal file
6
tests/errors/results/01_wrong_type.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"test\" is an invalid integer for \"variable_int\", which is not an integer, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_wrong_type.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/02_disabled_hidden_family.yaml
Normal file
6
tests/errors/results/02_disabled_hidden_family.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"family \"family_disabled_hidden\" is disabled and hidden, \"family_disabled_hidden.variable1\" will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/02_disabled_hidden_family.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/04_value_secret.yaml
Normal file
6
tests/errors/results/04_value_secret.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"**********\" is an invalid password for \"secret\", at least 10 characters are required, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/04_value_secret.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/05_value_family.yaml
Normal file
6
tests/errors/results/05_value_family.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"cannot set the value \"test\" to the family \"family\", it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/05_value_family.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/06_dynamic_unknown.yaml
Normal file
6
tests/errors/results/06_dynamic_unknown.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"dyn_unknown\" does not exist, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/06_dynamic_unknown.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
9
tests/errors/results/07_leadership_disabled.yaml
Normal file
9
tests/errors/results/07_leadership_disabled.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable \"leadership.follower_disabled\" at index \"0\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\"",
|
||||||
|
"variable \"leadership.follower_disabled\" at index \"1\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\"",
|
||||||
|
"variable \"leadership.follower_disabled\" at index \"2\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\"",
|
||||||
|
"variable \"leadership.follower_disabled_at_index\" at index \"1\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/errors/results/07_leadership_unknown.yaml
Normal file
6
tests/errors/results/07_leadership_unknown.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"leadership.unknwon\" does not exist, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_unknown.yaml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
68
tests/errors/structure/rougail/00_rougail.yml
Normal file
68
tests/errors/structure/rougail/00_rougail.yml
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
variable:
|
||||||
|
|
||||||
|
secret:
|
||||||
|
type: secret
|
||||||
|
params:
|
||||||
|
min_len: 10
|
||||||
|
|
||||||
|
variable_disabled:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
variable_disabled_hidden:
|
||||||
|
disabled: true
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
variable_int:
|
||||||
|
type: number
|
||||||
|
|
||||||
|
family:
|
||||||
|
|
||||||
|
variable:
|
||||||
|
|
||||||
|
family_disabled:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
variable1:
|
||||||
|
|
||||||
|
variable2:
|
||||||
|
|
||||||
|
family_disabled_hidden:
|
||||||
|
disabled: true
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
variable1:
|
||||||
|
|
||||||
|
variable2:
|
||||||
|
|
||||||
|
dyn_{{ identifier }}:
|
||||||
|
dynamic:
|
||||||
|
- var1
|
||||||
|
- var2
|
||||||
|
|
||||||
|
variable:
|
||||||
|
|
||||||
|
leadership:
|
||||||
|
type: leadership
|
||||||
|
|
||||||
|
leader:
|
||||||
|
|
||||||
|
follower:
|
||||||
|
|
||||||
|
follower_disabled:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
follower_disabled_at_index:
|
||||||
|
disabled:
|
||||||
|
jinja: >-
|
||||||
|
{% if index == 1 %}
|
||||||
|
true
|
||||||
|
{% else %}
|
||||||
|
{% endif %}
|
||||||
|
params:
|
||||||
|
index:
|
||||||
|
type: index
|
||||||
|
...
|
||||||
2
tests/errors/yaml/00_unknown_variable.yaml
Normal file
2
tests/errors/yaml/00_unknown_variable.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
unknown: 1
|
||||||
4
tests/errors/yaml/01_disabled_family.yaml
Normal file
4
tests/errors/yaml/01_disabled_family.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
family_disabled:
|
||||||
|
variable1: test
|
||||||
|
variable2: test
|
||||||
2
tests/errors/yaml/01_disabled_variable.yaml
Normal file
2
tests/errors/yaml/01_disabled_variable.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
variable_disabled: test
|
||||||
2
tests/errors/yaml/01_wrong_type.yaml
Normal file
2
tests/errors/yaml/01_wrong_type.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
variable_int: test
|
||||||
3
tests/errors/yaml/02_disabled_hidden_family.yaml
Normal file
3
tests/errors/yaml/02_disabled_hidden_family.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
family_disabled_hidden:
|
||||||
|
variable1: test
|
||||||
2
tests/errors/yaml/04_value_secret.yaml
Normal file
2
tests/errors/yaml/04_value_secret.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
secret: a
|
||||||
2
tests/errors/yaml/05_value_family.yaml
Normal file
2
tests/errors/yaml/05_value_family.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
family: test
|
||||||
3
tests/errors/yaml/06_dynamic_unknown.yaml
Normal file
3
tests/errors/yaml/06_dynamic_unknown.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
dyn_unknown:
|
||||||
|
variable: test
|
||||||
14
tests/errors/yaml/07_leadership_disabled.yaml
Normal file
14
tests/errors/yaml/07_leadership_disabled.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
leadership:
|
||||||
|
- leader: test1
|
||||||
|
follower: test1
|
||||||
|
follower_disabled: test1
|
||||||
|
follower_disabled_at_index: test1
|
||||||
|
- leader: test2
|
||||||
|
follower: test2
|
||||||
|
follower_disabled: test2
|
||||||
|
follower_disabled_at_index: test2
|
||||||
|
- leader: test3
|
||||||
|
follower: test3
|
||||||
|
follower_disabled: test3
|
||||||
|
follower_disabled_at_index: test3
|
||||||
4
tests/errors/yaml/07_leadership_unknown.yaml
Normal file
4
tests/errors/yaml/07_leadership_unknown.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
leadership:
|
||||||
|
- leader: test
|
||||||
|
unknwon: test
|
||||||
5
tests/errors/yaml/07_leadership_wrong_len.yaml
Normal file
5
tests/errors/yaml/07_leadership_wrong_len.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
leadership:
|
||||||
|
- leader: test
|
||||||
|
follower: test1
|
||||||
|
- follower: test1
|
||||||
3
tests/invalid/invalid/00.yml
Normal file
3
tests/invalid/invalid/00.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
a_family:
|
||||||
|
a_boolean: oups
|
||||||
3
tests/invalid/invalid_dyn/00.yml
Normal file
3
tests/invalid/invalid_dyn/00.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
a_str:
|
||||||
|
- ly
|
||||||
2
tests/invalid/invalid_family/00.yml
Normal file
2
tests/invalid/invalid_family/00.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
a_family: oups
|
||||||
4
tests/invalid/invalid_leadership/00.yml
Normal file
4
tests/invalid/invalid_leadership/00.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
a_leadership:
|
||||||
|
- a_leader: val1
|
||||||
|
a_follower: 1
|
||||||
2
tests/invalid/invalid_multi/00.yml
Normal file
2
tests/invalid/invalid_multi/00.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
a_multi: oups
|
||||||
5
tests/invalid/invalid_multi2/00.yml
Normal file
5
tests/invalid/invalid_multi2/00.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
a_family:
|
||||||
|
|
||||||
|
a_boolean:
|
||||||
|
- true
|
||||||
6
tests/invalid/results/invalid/errors.json
Normal file
6
tests/invalid/results/invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"oups\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), invalid value, it will be ignored when loading from the YAML file \"tests/invalid/invalid/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_family/errors.json
Normal file
6
tests/invalid/results/invalid_family/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"cannot set the value \"oups\" to the family \"a_family\" (A family), it will be ignored when loading from the YAML file \"tests/invalid/invalid_family/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_family_invalid/errors.json
Normal file
6
tests/invalid/results/invalid_family_invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"cannot set the value \"oups\" to the family \"a_family\" (A family), it will be ignored when loading from the YAML file \"tests/invalid/invalid_family/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"cannot set the value \"oups\" to the family \"a_family\" (A family), it will be ignored when loading from the YAML file \"tests/invalid/invalid_family/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_family_unknown/errors.json
Normal file
6
tests/invalid/results/invalid_family_unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"cannot set the value \"oups\" to the family \"a_family\" (A family), it will be ignored when loading from the YAML file \"tests/invalid/invalid_family/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_invalid/errors.json
Normal file
6
tests/invalid/results/invalid_invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"oups\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), invalid value, it will be ignored when loading from the YAML file \"tests/invalid/invalid/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"oups\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), invalid value, it will be ignored when loading from the YAML file \"tests/invalid/invalid/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_leadership/errors.json
Normal file
6
tests/invalid/results/invalid_leadership/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"1\" is an invalid string for \"a_leadership.a_follower\" (A follower) at index \"0\", which is not a string, it will be ignored when loading from the YAML file \"tests/invalid/invalid_leadership/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"1\" is an invalid string for \"a_leadership.a_follower\" (A follower) at index \"0\", which is not a string, it will be ignored when loading from the YAML file \"tests/invalid/invalid_leadership/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"1\" is an invalid string for \"a_leadership.a_follower\" (A follower) at index \"0\", which is not a string, it will be ignored when loading from the YAML file \"tests/invalid/invalid_leadership/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"1\" is an invalid string for \"a_leadership.a_follower\" (A follower) at index \"0\", which is not a string, it will be ignored when loading from the YAML file \"tests/invalid/invalid_leadership/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_multi/errors.json
Normal file
6
tests/invalid/results/invalid_multi/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"oups\" is an invalid string for \"a_multi\" (A multi), which must be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_multi2/errors.json
Normal file
6
tests/invalid/results/invalid_multi2/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"[True]\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), which must not be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi2/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_multi2_invalid/errors.json
Normal file
6
tests/invalid/results/invalid_multi2_invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"[True]\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), which must not be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi2/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"[True]\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), which must not be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi2/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_multi2_unknown/errors.json
Normal file
6
tests/invalid/results/invalid_multi2_unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"[True]\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), which must not be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi2/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_multi_invalid/errors.json
Normal file
6
tests/invalid/results/invalid_multi_invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"oups\" is an invalid string for \"a_multi\" (A multi), which must be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"the value \"oups\" is an invalid string for \"a_multi\" (A multi), which must be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_multi_unknown/errors.json
Normal file
6
tests/invalid/results/invalid_multi_unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"oups\" is an invalid string for \"a_multi\" (A multi), which must be a list, it will be ignored when loading from the YAML file \"tests/invalid/invalid_multi/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/invalid_unknown/errors.json
Normal file
6
tests/invalid/results/invalid_unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"the value \"oups\" is an invalid boolean for \"a_family.a_boolean\" (A boolean), invalid value, it will be ignored when loading from the YAML file \"tests/invalid/invalid/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/unknown/errors.json
Normal file
6
tests/invalid/results/unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"a_family.unknown\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/unknown2/errors.json
Normal file
6
tests/invalid/results/unknown2/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"an_unkown_family\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown2/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
6
tests/invalid/results/unknown2_invalid/errors.json
Normal file
6
tests/invalid/results/unknown2_invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"an_unkown_family\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown2/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"variable or family \"an_unkown_family\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown2/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/unknown2_unknown/errors.json
Normal file
6
tests/invalid/results/unknown2_unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"variable or family \"an_unkown_family\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown2/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/unknown_invalid/errors.json
Normal file
6
tests/invalid/results/unknown_invalid/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [],
|
||||||
|
"warnings": [
|
||||||
|
"variable or family \"a_family.unknown\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown/00.yml\""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"variable or family \"a_family.unknown\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
6
tests/invalid/results/unknown_unknown/errors.json
Normal file
6
tests/invalid/results/unknown_unknown/errors.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
"variable or family \"a_family.unknown\" does not exist, it will be ignored when loading from the YAML file \"tests/invalid/unknown/00.yml\""
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
23
tests/invalid/structure/00.yml
Normal file
23
tests/invalid/structure/00.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
a_multi: [] # A multi
|
||||||
|
|
||||||
|
a_leadership:
|
||||||
|
description: A leadership
|
||||||
|
type: leadership
|
||||||
|
|
||||||
|
a_leader: # A leader
|
||||||
|
|
||||||
|
a_follower: # A follower
|
||||||
|
|
||||||
|
a_str: # A str
|
||||||
|
- val1
|
||||||
|
|
||||||
|
a_family: # A family
|
||||||
|
|
||||||
|
a_boolean: true # A boolean
|
||||||
|
|
||||||
|
a_fami{{ identifier }}: # A dynamic family
|
||||||
|
...
|
||||||
3
tests/invalid/unknown/00.yml
Normal file
3
tests/invalid/unknown/00.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
a_family:
|
||||||
|
unknown: oups
|
||||||
3
tests/invalid/unknown2/00.yml
Normal file
3
tests/invalid/unknown2/00.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
an_unkown_family:
|
||||||
|
unknown: oups
|
||||||
|
|
@ -1 +1 @@
|
||||||
{}
|
{}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{}
|
{}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{}
|
{}
|
||||||
1
tests/results/00_0no_variable/file/all.yml
Normal file
1
tests/results/00_0no_variable/file/all.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
||||||
1
tests/results/00_0no_variable/file/all_exclude.yml
Normal file
1
tests/results/00_0no_variable/file/all_exclude.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
||||||
1
tests/results/00_0no_variable/file/mandatories.yml
Normal file
1
tests/results/00_0no_variable/file/mandatories.yml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
||||||
1
tests/results/00_0no_variable/makedict/mandatories.json
Normal file
1
tests/results/00_0no_variable/makedict/mandatories.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue