Compare commits
No commits in common. "4241cd25a7327e3ae6261b42eee0208d75a307ed" and "e7157de7b5c47336308803e3a32a61f12a6ec975" have entirely different histories.
4241cd25a7
...
e7157de7b5
7 changed files with 17 additions and 62 deletions
|
|
@ -1,9 +1,3 @@
|
||||||
## 0.0.1a1 (2024-11-27)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- support user data ansible with output ansible
|
|
||||||
|
|
||||||
## 0.0.1a0 (2024-11-25)
|
## 0.0.1a0 (2024-11-25)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"POT-Creation-Date: 2024-11-27 16:19+0100\n"
|
"POT-Creation-Date: 2024-11-25 10:49+0100\n"
|
||||||
"PO-Revision-Date: 2024-11-27 16:21+0100\n"
|
"PO-Revision-Date: 2024-11-25 10:51+0100\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: fr\n"
|
"Language: fr\n"
|
||||||
|
|
@ -16,6 +16,6 @@ msgstr ""
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
"X-Generator: Poedit 3.5\n"
|
"X-Generator: Poedit 3.5\n"
|
||||||
|
|
||||||
#: src/rougail/user_data_ansible/__init__.py:46
|
#: src/rougail/user_data_ansible/__init__.py:43
|
||||||
msgid "ansible is not set in step.user_data"
|
msgid "ansible is not set in step.user_data"
|
||||||
msgstr "ansible n'est pas définit dans step.user_data"
|
msgstr "ansible n'est pas définit dans step.user_data"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2024-11-27 16:21+0100\n"
|
"POT-Creation-Date: 2024-11-25 10:53+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -15,7 +15,7 @@ msgstr ""
|
||||||
"Generated-By: pygettext.py 1.5\n"
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
|
|
||||||
|
|
||||||
#: src/rougail/user_data_ansible/__init__.py:46
|
#: src/rougail/user_data_ansible/__init__.py:43
|
||||||
msgid "ansible is not set in step.user_data"
|
msgid "ansible is not set in step.user_data"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail.user_data_ansible"
|
name = "rougail.user_data_ansible"
|
||||||
version = "0.0.1a1"
|
version = "0.0.1a0"
|
||||||
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 ansible"
|
description = "Rougail user_data ansible"
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -16,19 +16,16 @@ 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 pathlib import Path
|
|
||||||
from ansible.parsing.vault import VaultLib, PromptVaultSecret
|
|
||||||
from ansible.module_utils._text import to_bytes
|
|
||||||
|
|
||||||
from rougail import RougailConfig
|
from rougail import RougailConfig
|
||||||
from rougail.user_data_file import RougailUserDataFile
|
from rougail.user_data_file import RougailUserDataFile
|
||||||
|
from ansible.parsing.vault import VaultLib, PromptVaultSecret
|
||||||
|
from ansible.module_utils._text import to_bytes
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
class RougailUserDataAnsible(RougailUserDataFile):
|
class RougailUserDataAnsible(RougailUserDataFile):
|
||||||
"""Load Ansible data from encrypted file
|
|
||||||
"""
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config,
|
config,
|
||||||
|
|
@ -52,13 +49,9 @@ class RougailUserDataAnsible(RougailUserDataFile):
|
||||||
self.warnings = []
|
self.warnings = []
|
||||||
|
|
||||||
def open(self, filename: str) -> dict:
|
def open(self, filename: str) -> dict:
|
||||||
"""Open file
|
prompt = PromptVaultSecret(to_bytes(self.secret), 'default', ["Vault password: "])
|
||||||
"""
|
vault = VaultLib([('default', prompt)])
|
||||||
prompt = PromptVaultSecret(
|
with Path(filename).open('rb') as fh:
|
||||||
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()))
|
return self.yaml.load(vault.decrypt(fh.read()))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,35 +19,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
def get_rougail_config(
|
def get_rougail_config(
|
||||||
*,
|
*,
|
||||||
backward_compatibility: bool = True, # pylint: disable=unused-argument
|
backward_compatibility=True,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""get rougail config for ansible"""
|
options = """
|
||||||
# redefine ansible family if already exists (for output)
|
|
||||||
# or create a new only only for user data
|
|
||||||
options = [
|
|
||||||
"""
|
|
||||||
ansible:
|
ansible:
|
||||||
exists: true
|
description: Configuration rougail-user-data-ansible
|
||||||
redefine: true
|
|
||||||
description: Configuration of user data or output Ansible
|
|
||||||
disabled:
|
|
||||||
type: jinja
|
|
||||||
jinja: |
|
|
||||||
{% if step.output != 'ansible' and 'ansible' not in step.user_data %}
|
|
||||||
disabled
|
|
||||||
{% endif %}
|
|
||||||
""",
|
|
||||||
"""
|
|
||||||
ansible:
|
|
||||||
exists: false
|
|
||||||
description: Configuration of user data Ansible
|
|
||||||
disabled:
|
disabled:
|
||||||
type: jinja
|
type: jinja
|
||||||
jinja: |
|
jinja: |
|
||||||
{% if 'ansible' not in step.user_data %}
|
{% if 'ansible' not in step.user_data %}
|
||||||
disabled
|
disabled
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
filename:
|
filename:
|
||||||
description: Ansible filename inventory
|
description: Ansible filename inventory
|
||||||
type: unix_filename
|
type: unix_filename
|
||||||
|
|
@ -57,24 +39,10 @@ ansible:
|
||||||
test_existence: True
|
test_existence: True
|
||||||
types:
|
types:
|
||||||
- file
|
- file
|
||||||
disabled:
|
|
||||||
type: jinja
|
|
||||||
jinja: |
|
|
||||||
{% if 'ansible' not in step.user_data %}
|
|
||||||
disabled
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
secret:
|
secret:
|
||||||
description: Secret to decrypt file
|
description: Secret to decrypt file
|
||||||
type: secret
|
type: secret
|
||||||
disabled:
|
"""
|
||||||
type: jinja
|
|
||||||
jinja: |
|
|
||||||
{% if 'ansible' not in step.user_data %}
|
|
||||||
disabled
|
|
||||||
{% endif %}
|
|
||||||
""",
|
|
||||||
]
|
|
||||||
return {
|
return {
|
||||||
"name": "ansible",
|
"name": "ansible",
|
||||||
"process": "user data",
|
"process": "user data",
|
||||||
|
|
@ -83,4 +51,4 @@ ansible:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("get_rougail_config",)
|
__all__ = "get_rougail_config"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue