Compare commits

..

4 commits

841 changed files with 7054 additions and 3675 deletions

View file

@ -1,3 +1,15 @@
## 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
# rougail-user-data-file

View file

@ -5,8 +5,8 @@
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"
"POT-Creation-Date: 2024-12-11 21:26+0100\n"
"PO-Revision-Date: 2024-12-11 21:27+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_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: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:58
#: src/rougail/user_data_yaml/__init__.py:61
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_yaml/__init__.py:74
msgid "yaml ({0})"
msgstr "fichier yaml ({0})"
#: src/rougail/user_data_file/__init__.py:88
#: src/rougail/user_data_yaml/__init__.py:103
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-11-01 12:13+0100\n"
"POT-Creation-Date: 2024-12-11 21:27+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_file/__init__.py:40
msgid "file is not set in step.user_data"
#: src/rougail/user_data_yaml/__init__.py:42
msgid "yaml is not set in step.user_data"
msgstr ""
#: src/rougail/user_data_file/__init__.py:58
#: src/rougail/user_data_yaml/__init__.py:61
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})"
#: src/rougail/user_data_yaml/__init__.py:74
msgid "yaml ({0})"
msgstr ""
#: src/rougail/user_data_file/__init__.py:88
#: src/rougail/user_data_yaml/__init__.py:103
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_file"
version = "0.1.0"
name = "rougail.user_data_yaml"
version = "0.2.0a0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data file"
description = "Rougail user_data yaml"
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-file"
Home = "https://forge.cloud.silique.fr/stove/rougail-user-data-yaml"
[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,15 +15,16 @@ 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 ruamel.yaml import YAML
from rougail.error import ExtentionError
from tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError
from .i18n import _
class RougailUserDataFile:
class RougailUserDataYaml:
def __init__(
self,
config,
@ -33,15 +34,14 @@ class RougailUserDataFile:
if rougailconfig is None:
rougailconfig = RougailConfig
user_data = rougailconfig["step.user_data"]
if "file" not in user_data:
user_data.append("file")
if "yaml" not in user_data:
user_data.append("yaml")
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"))
if "yaml" not in user_data:
raise ExtentionError(_("yaml is not set in step.user_data"))
self.rougailconfig = rougailconfig
self.filenames = self.rougailconfig["file.filename"]
self.yaml = YAML()
self.filenames = self.rougailconfig["yaml.filename"]
self.config = config
self.errors = []
self.warnings = []
@ -49,29 +49,29 @@ class RougailUserDataFile:
def run(
self,
) -> None:
self.yaml = YAML()
user_datas = []
for filename in self.filenames:
with open(filename) as fh_config:
file_values = self.yaml.load(fh_config)
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)
)
continue
values = {}
self.parse(
values,
"",
file_values,
filename,
)
else:
self.parse(
values,
"",
file_values,
filename,
)
user_datas.append(
{
"source": _("file ({0})").format(filename),
"source": _("yaml ({0})").format(filename),
"errors": self.errors,
"warnings": self.warnings,
"values": values,
@ -79,6 +79,10 @@ class RougailUserDataFile:
)
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,
@ -113,7 +117,7 @@ class RougailUserDataFile:
values[path] = value
RougailUserData = RougailUserDataFile
RougailUserData = RougailUserDataYaml
__all__ = ("RougailUserDataFile",)
__all__ = ("RougailUserDataYaml",)

View file

@ -1,5 +1,5 @@
"""
Config file for Rougail-user-data
Config yaml 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 = """
file:
description: Configuration rougail-user-data-file
yaml:
description: Configuration rougail-user-data-yaml
disabled:
type: jinja
jinja: |
{% if 'file' not in step.user_data %}
{% if 'yaml' not in step.user_data %}
disabled
{% endif %}
filename:
description: Filename with user data
description: Filename
alternative_name: ff
type: unix_filename
multi: true
@ -44,7 +44,7 @@ file:
- file
"""
return {
"name": "file",
"name": "yaml",
"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_file", str(Path(__file__).parent / "locale"), fallback=True
"rougail_user_data_yaml", str(Path(__file__).parent / "locale"), fallback=True
)
_ = t.gettext

View file

@ -1 +0,0 @@
{}

View file

@ -1 +1 @@
{}
{}

View file

@ -1 +1 @@
{}
{}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,12 @@
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,7 +1,12 @@
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,4 +1,8 @@
rougail:
var1:
- domain1.lan
- domain2.lan
{
"rougail": {
"var1": [
"domain1.lan",
"domain2.lan"
]
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,10 @@
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,7 +1,10 @@
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,2 +1,5 @@
rougail:
variable: true
{
"rougail": {
"variable": true
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,10 @@
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,7 +1,10 @@
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,7 +1,10 @@
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,7 +1,10 @@
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,4 +1,7 @@
rougail:
variable1: '80'
variable2: '80'
variable3: '80'
{
"rougail": {
"variable1": "80",
"variable2": "80",
"variable3": "80"
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1 +1 @@
{}
{}

View file

@ -1,7 +1,10 @@
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,10 @@
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,4 +1,7 @@
rougail:
var1: string1
var2: string1
var3: string1
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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