Compare commits

..

No commits in common. "fa039c1743b53a3349776215f5e7529987193c00" and "b0fdef7a52291cdd6a31fab8423ef76b98b2b4c6" have entirely different histories.

15 changed files with 20 additions and 111 deletions

View file

@ -1,13 +1,3 @@
## 0.2.0a1 (2025-02-10)
### Feat
- add new parameter yaml.file_with_secrets
### Fix
- update tests
## 0.2.0a0 (2024-12-11)
### Feat

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-02-10 09:21+0100\n"
"PO-Revision-Date: 2025-02-10 09:22+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"
@ -20,28 +20,16 @@ msgstr ""
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:62
#: 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_yaml/__init__.py:85
#: src/rougail/user_data_yaml/__init__.py:74
msgid "yaml ({0})"
msgstr "fichier yaml ({0})"
#: src/rougail/user_data_yaml/__init__.py:116
#: src/rougail/user_data_yaml/__init__.py:103
msgid "\"{0}\" in {1} has an unknown value"
msgstr "\"{0}\" dans {1} a une valeur inconnue"
#: src/rougail/user_data_yaml/config.py:29
msgid "Configuration rougail-user-data-yaml"
msgstr "Configuration de rougail-user-data-yaml"
#: src/rougail/user_data_yaml/config.py:38
msgid "Filename"
msgstr "Nom du fichier"
#: src/rougail/user_data_yaml/config.py:49
msgid "File that may contain secrets"
msgstr "Le fichier peut contenir des secrets"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-02-10 09:22+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"
@ -19,27 +19,15 @@ msgstr ""
msgid "yaml is not set in step.user_data"
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:62
#: 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_yaml/__init__.py:85
#: src/rougail/user_data_yaml/__init__.py:74
msgid "yaml ({0})"
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:116
#: src/rougail/user_data_yaml/__init__.py:103
msgid "\"{0}\" in {1} has an unknown value"
msgstr ""
#: src/rougail/user_data_yaml/config.py:29
msgid "Configuration rougail-user-data-yaml"
msgstr ""
#: src/rougail/user_data_yaml/config.py:38
msgid "Filename"
msgstr ""
#: src/rougail/user_data_yaml/config.py:49
msgid "File that may contain secrets"
msgstr ""

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_yaml"
version = "0.2.0a1"
version = "0.2.0a0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data yaml"

View file

@ -1,6 +1,6 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2024-2025
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
@ -17,6 +17,7 @@ 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 tiramisu.error import ValueOptionError, PropertiesOptionError, LeadershipError
@ -31,7 +32,6 @@ class RougailUserDataYaml:
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:
@ -42,7 +42,6 @@ class RougailUserDataYaml:
raise ExtentionError(_("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 = []
@ -52,7 +51,7 @@ class RougailUserDataYaml:
) -> None:
self.yaml = YAML()
user_datas = []
for idx, filename in enumerate(self.filenames):
for filename in self.filenames:
file_values = self.open(filename)
if not file_values:
continue
@ -70,24 +69,12 @@ class RougailUserDataYaml:
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':
if not idx:
last_filenames = len(self.filenames) - 1
allow_secrets_variables = idx == last_filenames
else:
allow_secrets_variables = True
user_datas.append(
{
"source": _("yaml ({0})").format(filename),
"errors": self.errors,
"warnings": self.warnings,
"values": values,
'options': {'allow_secrets_variables': allow_secrets_variables,
},
}
)
return user_datas

View file

@ -2,7 +2,7 @@
Config yaml for Rougail-user-data
Silique (https://www.silique.fr)
Copyright (C) 2024-2025
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
@ -17,25 +17,23 @@ 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 .i18n import _
def get_rougail_config(
*,
backward_compatibility=True,
) -> dict:
options = f"""
options = """
yaml:
description: {_("Configuration rougail-user-data-yaml")}
description: Configuration rougail-user-data-yaml
disabled:
type: jinja
jinja: |
{{% if 'yaml' not in step.user_data %}}
{% if 'yaml' not in step.user_data %}
disabled
{{% endif %}}
{% endif %}
filename:
description: {_("Filename")}
description: Filename
alternative_name: ff
type: unix_filename
multi: true
@ -44,15 +42,6 @@ yaml:
test_existence: True
types:
- file
file_with_secrets:
description: {_("File that may contain secrets")}
default: all
choices:
- all
- first
- last
- none
"""
return {
"name": "yaml",

View file

@ -1,6 +1,6 @@
"""Internationalisation utilities
Silique (https://www.silique.fr)
Copyright (C) 2024-2025
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

View file

@ -1,4 +0,0 @@
{
"errors": [],
"warnings": []
}

View file

@ -1,4 +0,0 @@
{
"errors": [],
"warnings": []
}

View file

@ -1,6 +0,0 @@
{
"rougail": {
"secret1": "string1",
"secret2": "string1"
}
}

View file

@ -1,6 +0,0 @@
{
"rougail": {
"secret1": "string1",
"secret2": "string1"
}
}

View file

@ -1,5 +0,0 @@
{
"rougail": {
"secret1": "string1"
}
}

View file

@ -1,4 +0,0 @@
{
"rougail.secret1": "string1",
"rougail.secret2": "string1"
}

View file

@ -1,4 +0,0 @@
{
"rougail.secret1": "string1",
"rougail.secret2": "value"
}