Compare commits

..

No commits in common. "develop" and "main" have entirely different histories.

841 changed files with 3675 additions and 7054 deletions

View file

@ -1,15 +1,3 @@
## 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)
### Fix

View file

@ -1,2 +1,2 @@
# rougail-user-data-file
# rougail-user-data

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2024-12-11 21:26+0100\n"
"PO-Revision-Date: 2024-12-11 21:27+0100\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"
@ -16,20 +16,20 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.5\n"
#: src/rougail/user_data_yaml/__init__.py:42
msgid "yaml is not set in step.user_data"
msgstr "\"yaml\" n'est pas défini dans step.user_data"
#: 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_yaml/__init__.py:61
#: 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_yaml/__init__.py:74
msgid "yaml ({0})"
msgstr "fichier yaml ({0})"
#: src/rougail/user_data_file/__init__.py:66
msgid "file ({0})"
msgstr "fichier ({0})"
#: src/rougail/user_data_yaml/__init__.py:103
#: src/rougail/user_data_file/__init__.py:88
msgid "\"{0}\" in {1} has an unknown value"
msgstr "\"{0}\" dans {1} a une valeur inconnue"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-12-11 21:27+0100\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"
@ -15,19 +15,19 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
#: src/rougail/user_data_yaml/__init__.py:42
msgid "yaml is not set in step.user_data"
#: src/rougail/user_data_file/__init__.py:40
msgid "file is not set in step.user_data"
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:61
#: 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_yaml/__init__.py:74
msgid "yaml ({0})"
#: src/rougail/user_data_file/__init__.py:66
msgid "file ({0})"
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:103
#: src/rougail/user_data_file/__init__.py:88
msgid "\"{0}\" in {1} has an unknown value"
msgstr ""

View file

@ -3,11 +3,11 @@ build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_yaml"
version = "0.2.0a0"
name = "rougail.user_data_file"
version = "0.1.0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data yaml"
description = "Rougail user_data file"
requires-python = ">=3.8"
license = {file = "LICENSE"}
classifiers = [
@ -29,12 +29,12 @@ dependencies = [
]
[project.urls]
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-yaml"
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-file"
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "$version"
version_scheme = "pep440"
version_provider = "pep621"
update_changelog_on_bump = true
#update_changelog_on_bump = true
changelog_merge_prerelease = true

View file

@ -15,16 +15,15 @@ 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 rougail import RougailConfig
from rougail.error import ExtentionError
from ruamel.yaml import YAML
from tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError
from .i18n import _
class RougailUserDataYaml:
class RougailUserDataFile:
def __init__(
self,
config,
@ -34,14 +33,15 @@ class RougailUserDataYaml:
if rougailconfig is None:
rougailconfig = RougailConfig
user_data = rougailconfig["step.user_data"]
if "yaml" not in user_data:
user_data.append("yaml")
if "file" not in user_data:
user_data.append("file")
rougailconfig["step.user_data"] = user_data
user_data = rougailconfig["step.user_data"]
if "yaml" not in user_data:
raise ExtentionError(_("yaml is not set in 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["yaml.filename"]
self.filenames = self.rougailconfig["file.filename"]
self.yaml = YAML()
self.config = config
self.errors = []
self.warnings = []
@ -49,29 +49,29 @@ class RougailUserDataYaml:
def run(
self,
) -> None:
self.yaml = YAML()
user_datas = []
for filename in self.filenames:
file_values = self.open(filename)
with open(filename) as fh_config:
file_values = self.yaml.load(fh_config)
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,
)
continue
values = {}
self.parse(
values,
"",
file_values,
filename,
)
user_datas.append(
{
"source": _("yaml ({0})").format(filename),
"source": _("file ({0})").format(filename),
"errors": self.errors,
"warnings": self.warnings,
"values": values,
@ -79,10 +79,6 @@ class RougailUserDataYaml:
)
return user_datas
def open(self, filename: str) -> dict:
with open(filename) as fh_config:
return self.yaml.load(fh_config)
def parse(
self,
values: dict,
@ -117,7 +113,7 @@ class RougailUserDataYaml:
values[path] = value
RougailUserData = RougailUserDataYaml
RougailUserData = RougailUserDataFile
__all__ = ("RougailUserDataYaml",)
__all__ = ("RougailUserDataFile",)

View file

@ -1,5 +1,5 @@
"""
Config yaml for Rougail-user-data
Config file for Rougail-user-data
Silique (https://www.silique.fr)
Copyright (C) 2024
@ -24,16 +24,16 @@ def get_rougail_config(
backward_compatibility=True,
) -> dict:
options = """
yaml:
description: Configuration rougail-user-data-yaml
file:
description: Configuration rougail-user-data-file
disabled:
type: jinja
jinja: |
{% if 'yaml' not in step.user_data %}
{% if 'file' not in step.user_data %}
disabled
{% endif %}
filename:
description: Filename
description: Filename with user data
alternative_name: ff
type: unix_filename
multi: true
@ -44,7 +44,7 @@ yaml:
- file
"""
return {
"name": "yaml",
"name": "file",
"process": "user data",
"options": options,
"level": 50,

View file

@ -20,7 +20,7 @@ from gettext import translation
from pathlib import Path
t = translation(
"rougail_user_data_yaml", str(Path(__file__).parent / "locale"), fallback=True
"rougail_user_data_file", str(Path(__file__).parent / "locale"), fallback=True
)
_ = t.gettext

View file

@ -0,0 +1 @@
{}

View file

@ -1 +1 @@
{}
{}

View file

@ -1 +1 @@
{}
{}

View file

@ -1,5 +1,2 @@
{
"rougail": {
"version": "string1"
}
}
rougail:
version: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"version": "string1"
}
}
rougail:
version: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"version": "string1"
}
}
rougail:
version: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"empty": "string1"
}
}
rougail:
empty: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"empty": "string1"
}
}
rougail:
empty: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"empty": "string1"
}
}
rougail:
empty: string1

View file

@ -1,10 +1,6 @@
{
"rougail": {
"var1": "string1",
"var2": [
"string1",
"string2",
"string3"
]
}
}
rougail:
var1: string1
var2:
- string1
- string2
- string3

View file

@ -1,10 +1,6 @@
{
"rougail": {
"var1": "string1",
"var2": [
"string1",
"string2",
"string3"
]
}
}
rougail:
var1: string1
var2:
- string1
- string2
- string3

View file

@ -1,14 +1,9 @@
{
"rougail": {
"var1": [
"string1",
"string2",
"string3"
],
"var2": [
"string1",
"string2",
"string3"
]
}
}
rougail:
var1:
- string1
- string2
- string3
var2:
- string1
- string2
- string3

View file

@ -1,14 +1,9 @@
{
"rougail": {
"var1": [
"string1",
"string2",
"string3"
],
"var2": [
"string1",
"string2",
"string3"
]
}
}
rougail:
var1:
- string1
- string2
- string3
var2:
- string1
- string2
- string3

View file

@ -1,12 +1,7 @@
{
"rougail": {
"var1": [
"domain1.lan",
"domain2.lan"
],
"var2": [
"domain1.lan",
"domain2.lan"
]
}
}
rougail:
var1:
- domain1.lan
- domain2.lan
var2:
- domain1.lan
- domain2.lan

View file

@ -1,12 +1,7 @@
{
"rougail": {
"var1": [
"domain1.lan",
"domain2.lan"
],
"var2": [
"domain1.lan",
"domain2.lan"
]
}
}
rougail:
var1:
- domain1.lan
- domain2.lan
var2:
- domain1.lan
- domain2.lan

View file

@ -1,8 +1,4 @@
{
"rougail": {
"var1": [
"domain1.lan",
"domain2.lan"
]
}
}
rougail:
var1:
- domain1.lan
- domain2.lan

View file

@ -1,6 +1,2 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}
rougail:
var1: string1

View file

@ -1,6 +1,2 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}
rougail:
var1: string1

View file

@ -1,6 +1,2 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}
rougail:
var1: string1

View file

@ -1,4 +1,3 @@
{
"rougail.var1": "string1",
"rougail.var2": "string1"
"rougail.var1": "string1"
}

View file

@ -1,4 +1,3 @@
{
"rougail.var1": "string1",
"rougail.var2": "string1"
"rougail.var1": "string1"
}

View file

@ -1,5 +1,2 @@
{
"rougail": {
"without_type": "string1"
}
}
rougail:
without_type: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"without_type": "string1"
}
}
rougail:
without_type: string1

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": true,
"var2": true,
"var3": true,
"var4": true,
"var5": true,
"var6": true
}
}
rougail:
var1: true
var2: true
var3: true
var4: true
var5: true
var6: true

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": true,
"var2": true,
"var3": true,
"var4": true,
"var5": true,
"var6": true
}
}
rougail:
var1: true
var2: true
var3: true
var4: true
var5: true
var6: true

View file

@ -1 +1 @@
{}
{}

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": true
}
}
rougail:
variable: true

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": true
}
}
rougail:
variable: true

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": "a",
"var2": "a",
"var3": "a",
"var4": null,
"var5": "a",
"var6": 1
}
}
rougail:
var1: a
var2: a
var3: a
var4:
var5: a
var6: 1

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": "a",
"var2": "a",
"var3": "a",
"var4": null,
"var5": "a",
"var6": 1
}
}
rougail:
var1: a
var2: a
var3: a
var4:
var5: a
var6: 1

View file

@ -1,6 +1,3 @@
{
"rougail": {
"var1": "a",
"var2": "a"
}
}
rougail:
var1: a
var2: a

View file

@ -1,5 +1,2 @@
{
"rougail": {
"var": 0
}
}
rougail:
var: 0

View file

@ -1,5 +1,2 @@
{
"rougail": {
"var": 0
}
}
rougail:
var: 0

View file

@ -1,10 +1,6 @@
{
"rougail": {
"var1": [
"string1",
"string2",
"string3"
],
"var2": "string1"
}
}
rougail:
var1:
- string1
- string2
- string3
var2: string1

View file

@ -1,10 +1,6 @@
{
"rougail": {
"var1": [
"string1",
"string2",
"string3"
],
"var2": "string1"
}
}
rougail:
var1:
- string1
- string2
- string3
var2: string1

View file

@ -1,6 +1,3 @@
{
"rougail": {
"custom1": "string1",
"custom2": "string1"
}
}
rougail:
custom1: string1
custom2: string1

View file

@ -1,6 +1,3 @@
{
"rougail": {
"custom1": "string1",
"custom2": "string1"
}
}
rougail:
custom1: string1
custom2: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"custom1": "string1"
}
}
rougail:
custom1: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "domain1.lan"
}
}
rougail:
variable: domain1.lan

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "domain1.lan"
}
}
rougail:
variable: domain1.lan

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "domain1.lan"
}
}
rougail:
variable: domain1.lan

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "domain1.lan"
}
}
rougail:
variable: domain1.lan

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": 1.1,
"var2": 1.1,
"var3": 1.1,
"var4": 1.1,
"var5": 1.1,
"var6": 1.1
}
}
rougail:
var1: 1.1
var2: 1.1
var3: 1.1
var4: 1.1
var5: 1.1
var6: 1.1

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": 1.1,
"var2": 1.1,
"var3": 1.1,
"var4": 1.1,
"var5": 1.1,
"var6": 1.1
}
}
rougail:
var1: 1.1
var2: 1.1
var3: 1.1
var4: 1.1
var5: 1.1
var6: 1.1

View file

@ -1 +1 @@
{}
{}

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": 1,
"var2": 1,
"var3": 1,
"var4": 1,
"var5": 1,
"var6": 1
}
}
rougail:
var1: 1
var2: 1
var3: 1
var4: 1
var5: 1
var6: 1

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": 1,
"var2": 1,
"var3": 1,
"var4": 1,
"var5": 1,
"var6": 1
}
}
rougail:
var1: 1
var2: 1
var3: 1
var4: 1
var5: 1
var6: 1

View file

@ -1 +1 @@
{}
{}

View file

@ -1,7 +1,4 @@
{
"rougail": {
"variable1": "80",
"variable2": "80",
"variable3": "80"
}
}
rougail:
variable1: '80'
variable2: '80'
variable3: '80'

View file

@ -1,7 +1,4 @@
{
"rougail": {
"variable1": "80",
"variable2": "80",
"variable3": "80"
}
}
rougail:
variable1: '80'
variable2: '80'
variable3: '80'

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable1": "80"
}
}
rougail:
variable1: '80'

View file

@ -1,5 +1,2 @@
{
"rougail": {
"var": "#b1b1b1"
}
}
rougail:
var: '#b1b1b1'

View file

@ -1,5 +1,2 @@
{
"rougail": {
"var": "#b1b1b1"
}
}
rougail:
var: '#b1b1b1'

View file

@ -1 +1 @@
{}
{}

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1",
"var4": "string1",
"var5": "string1",
"var6": "string1"
}
}
rougail:
var1: string1
var2: string1
var3: string1
var4: string1
var5: string1
var6: string1

View file

@ -1,10 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1",
"var4": "string1",
"var5": "string1",
"var6": "string1"
}
}
rougail:
var1: string1
var2: string1
var3: string1
var4: string1
var5: string1
var6: string1

View file

@ -1,7 +1,4 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}
rougail:
var1: string1
var2: string1
var3: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"var": "quote'"
}
}
rougail:
var: quote'

View file

@ -1,5 +1,2 @@
{
"rougail": {
"var": "quote'"
}
}
rougail:
var: quote'

View file

@ -1,6 +1,3 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}
rougail:
var1: string1
var2: string1

View file

@ -1,6 +1,3 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}
rougail:
var1: string1
var2: string1

View file

@ -1,6 +1,3 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}
rougail:
var1: string1
var2: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,5 +1,2 @@
{
"rougail": {
"variable": "string1"
}
}
rougail:
variable: string1

View file

@ -1,13 +1,6 @@
{
"rougail": {
"var1": "test",
"var2": "test",
"var3": "test1",
"var4": null,
"var5": false,
"var6": [
"test1",
"test2"
]
}
}
rougail:
var1: test
var2: test
var3: test1
var4:
var5: false

View file

@ -1,13 +1,6 @@
{
"rougail": {
"var1": "test",
"var2": "test",
"var3": "test1",
"var4": null,
"var5": false,
"var6": [
"test1",
"test2"
]
}
}
rougail:
var1: test
var2: test
var3: test1
var4:
var5: false

View file

@ -1,10 +1,3 @@
{
"rougail": {
"var1": "test",
"var3": "test1",
"var6": [
"test1",
"test2"
]
}
}
rougail:
var1: test
var3: test1

View file

@ -3,9 +3,5 @@
"rougail.var2": "test",
"rougail.var3": "test1",
"rougail.var4": null,
"rougail.var5": false,
"rougail.var6": [
"test1",
"test2"
]
"rougail.var5": false
}

Some files were not shown because too many files have changed in this diff Show more