From 2b465cfc67fe0192656c44a93c54f5dfce0da6bc Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 12 Mar 2022 10:05:58 +0100 Subject: [PATCH] missing files --- servers.json.example | 8 +++++ src/risotto/__init__.py | 0 src/risotto/rougail/__init__.py | 0 src/risotto/rougail/annotator.py | 57 ++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 src/risotto/__init__.py create mode 100644 src/risotto/rougail/__init__.py create mode 100644 src/risotto/rougail/annotator.py diff --git a/servers.json.example b/servers.json.example index 7002069..41bcb69 100644 --- a/servers.json.example +++ b/servers.json.example @@ -11,6 +11,7 @@ }, "modules": {"host": {"applicationservices": ["host-systemd-machined"]}, "unbound": {"applicationservices": ["unbound", "provider-systemd-machined"]}, + "letsencrypt": {"applicationservices": ["letsencrypt", "provider-systemd-machined"]}, "nsd": {"applicationservices": ["nsd", "provider-systemd-machined"]}, "revprox": {"applicationservices": ["nginx-reverse-proxy-server", "provider-systemd-machined"]}, "postgresql": {"applicationservices": ["postgresql-server", "provider-systemd-machined"]}, @@ -176,6 +177,13 @@ "rougail.smtp.smtp_relay_address": "mail.in.silique.fr" } }, + "letsencrypt.in.silique.fr": {"module": "letsencrypt", + "informations": {"zones_name": ["external"] + }, + "values": {"rougail.host": "cloud.silique.fr", + "rougail.dns.dns_client_address": "unbound.in.silique.fr" + } + }, "gitea.in.silique.fr": {"module": "gitea", "informations": {"zones_name": ["external"] }, diff --git a/src/risotto/__init__.py b/src/risotto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/risotto/rougail/__init__.py b/src/risotto/rougail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/risotto/rougail/annotator.py b/src/risotto/rougail/annotator.py new file mode 100644 index 0000000..15aa063 --- /dev/null +++ b/src/risotto/rougail/annotator.py @@ -0,0 +1,57 @@ +from rougail.annotator.variable import Walk +from risotto.utils import _ + + +class Annotator(Walk): + level = 9 + def __init__(self, + objectspace: 'RougailObjSpace', + *args): + self.objectspace = objectspace +# self.convert_get_linked_information() +# self.convert_provider() + + def convert_get_linked_information(self): + if not hasattr(self.objectspace.space, 'constraints') or \ + not hasattr(self.objectspace.space.constraints, 'fill'): + return + for fill in self.objectspace.space.constraints.fill: + if fill.name == 'get_linked_configuration': + # add server_name + param = self.objectspace.param(fill.xmlfiles) + param.name = 'server_name' + param.type = 'information' + param.text = 'server_name' + fill.param.append(param) + # add current_user + param = self.objectspace.param(fill.xmlfiles) + param.name = 'current_user' + param.type = 'information' + param.text = 'current_user' + fill.param.append(param) + # add test + param = self.objectspace.param(fill.xmlfiles) + param.name = 'test' + param.type = 'target_information' + param.text = 'test' + fill.param.append(param) + + def convert_provider(self): + if not hasattr(self.objectspace.space, 'variables'): + return + for family in self.get_families(): + if not hasattr(family, 'provider'): + continue + if 'dynamic' not in vars(family): + raise Exception(_(f'{family.name} is not a dynamic family so cannot have provider attribute')) + if not hasattr(family, 'information'): + family.information = self.objectspace.information(family.xmlfiles) + family.information.provider = family.provider + del family.provider + for variable in self.get_variables(): + if not hasattr(variable, 'provider'): + continue + if not hasattr(variable, 'information'): + variable.information = self.objectspace.information(variable.xmlfiles) + variable.information.provider = variable.provider + del variable.provider