Compare commits

..

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

8 changed files with 0 additions and 278 deletions

View file

@ -1,29 +0,0 @@
## 0.0.1a4 (2025-01-02)
### Fix
- output ansible is loaded after
## 0.0.1a3 (2024-12-11)
### Fix
- user-data file is now user-data yaml
## 0.0.1a2 (2024-12-11)
### Fix
- specialize error
## 0.0.1a1 (2024-11-27)
### Fix
- support user data ansible with output ansible
## 0.0.1a0 (2024-11-25)
### Fix
- new ansible plugin loader

View file

@ -1,21 +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-27 16:19+0100\n"
"PO-Revision-Date: 2024-11-27 16:21+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_ansible/__init__.py:46
msgid "ansible is not set in step.user_data"
msgstr "ansible n'est pas définit dans step.user_data"

View file

@ -1,21 +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-27 16:21+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_ansible/__init__.py:46
msgid "ansible is not set in step.user_data"
msgstr ""

View file

@ -1,41 +0,0 @@
[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_ansible"
version = "0.0.1a4"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data ansible"
requires-python = ">=3.8"
license = {file = "LICENSE"}
classifiers = [
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"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.12",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Natural Language :: English",
"Natural Language :: French",
]
dependencies = [
"rougail-user-data-yaml >= 0.1,<2",
"ansible",
]
[project.urls]
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
changelog_merge_prerelease = true

View file

@ -1,69 +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 pathlib import Path
from ansible.parsing.vault import VaultLib, PromptVaultSecret
from ansible.module_utils._text import to_bytes
from rougail import RougailConfig
from rougail.user_data_yaml import RougailUserDataYaml
from rougail.error import ExtentionError
from .i18n import _
class RougailUserDataAnsible(RougailUserDataYaml):
"""Load Ansible data from encrypted file
"""
def __init__(
self,
config,
*,
rougailconfig=None,
) -> None:
if rougailconfig is None:
rougailconfig = RougailConfig
user_data = rougailconfig["step.user_data"]
if "ansible" not in user_data:
user_data.append("ansible")
rougailconfig["step.user_data"] = user_data
user_data = rougailconfig["step.user_data"]
if "ansible" not in user_data:
raise ExtentionError(_("ansible is not set in step.user_data"))
self.rougailconfig = rougailconfig
self.filenames = self.rougailconfig["ansible.filename"]
self.secret = self.rougailconfig["ansible.secret"]
self.config = config
self.errors = []
self.warnings = []
def open(self, filename: str) -> dict:
"""Open file
"""
prompt = PromptVaultSecret(
to_bytes(self.secret), "default", ["Vault password: "]
)
vault = VaultLib([("default", prompt)])
with Path(filename).open("rb") as fh:
return self.yaml.load(vault.decrypt(fh.read()))
RougailUserData = RougailUserDataAnsible
__all__ = ("RougailUserDataAnsible",)

View file

@ -1,71 +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/>.
"""
def get_rougail_config(
*,
backward_compatibility: bool = True, # pylint: disable=unused-argument
) -> dict:
"""get rougail config for ansible"""
# redefine ansible family if already exists (for output)
# or create a new only only for user data
options = """
ansible:
description: Configuration of user data Ansible
disabled:
type: jinja
jinja: |
{% if 'ansible' not in step.user_data %}
disabled
{% endif %}
filename:
description: Ansible filename inventory
type: unix_filename
multi: true
params:
allow_relative: True
test_existence: True
types:
- file
disabled:
type: jinja
jinja: |
{% if 'ansible' not in step.user_data %}
disabled
{% endif %}
secret:
description: Secret to decrypt file
type: secret
disabled:
type: jinja
jinja: |
{% if 'ansible' not in step.user_data %}
disabled
{% endif %}
"""
return {
"name": "ansible",
"process": "user data",
"options": options,
"level": 60,
}
__all__ = ("get_rougail_config",)

View file

@ -1,26 +0,0 @@
"""Internationalisation utilities
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 gettext import translation
from pathlib import Path
t = translation(
"rougail_user_data_ansible", str(Path(__file__).parent / "locale"), fallback=True
)
_ = t.gettext