Compare commits

...

2 Commits

23 changed files with 27 additions and 59 deletions

View File

@ -40,12 +40,12 @@ IPAddressDeny=any
ROUGAIL_DEST = '/usr/local/lib' ROUGAIL_DEST = '/usr/local/lib'
ROUGAIL_GLOBAL_SYSTEMD_FILE = '/usr/lib/systemd/system' ROUGAIL_GLOBAL_SYSTEMD_FILE = '/usr/lib/systemd/system'
ROUGAIL_DEST_FILE = '/tmpfiles.d/0rougail.conf'
ROUGAIL_TMPL_TEMPLATE = f"""%def display(%%file, %%filename) ROUGAIL_TMPL_TEMPLATE = f"""%def display(%%file, %%filename)
%if %%filename.startswith('/etc/') or %%filename.startswith('/var/') or %%filename.startswith('/srv/') %if %%filename.startswith('/etc/') or %%filename.startswith('/var/') or %%filename.startswith('/srv/')
C %%filename %%file.mode %%file.owner %%file.group - {ROUGAIL_DEST}%%filename C %%filename %%file.mode %%file.owner %%file.group - {ROUGAIL_DEST}%%filename
z %%filename - - - - -
%end if %end if
%end def %end def
%for %%service in %%services %for %%service in %%services
@ -186,13 +186,12 @@ class RougailSystemdTemplate(RougailBaseTemplate):
self.ip_per_service = None self.ip_per_service = None
def post_instance(self): def post_instance(self):
destfile = '/tmpfiles.d/0rougail.conf' destfilename = join(self.destinations_dir, ROUGAIL_DEST_FILE[1:])
destfilename = join(self.destinations_dir, destfile[1:])
makedirs(dirname(destfilename), exist_ok=True) makedirs(dirname(destfilename), exist_ok=True)
self.log.info(_(f"creole processing: '{destfilename}'")) self.log.info(_(f"creole processing: '{destfilename}'"))
self.engines['creole'].process(filename=None, self.engines['creole'].process(filename=None,
source=ROUGAIL_TMPL_TEMPLATE, source=ROUGAIL_TMPL_TEMPLATE,
true_destfilename=destfile, true_destfilename=ROUGAIL_DEST_FILE,
destfilename=destfilename, destfilename=destfilename,
destdir=self.destinations_dir, destdir=self.destinations_dir,
variable=None, variable=None,

View File

@ -61,19 +61,26 @@ class XMLReflector:
:param xmlfolders: list of full folder's name :param xmlfolders: list of full folder's name
""" """
filenames = {}
for xmlfolder in xmlfolders: for xmlfolder in xmlfolders:
filenames = [join(xmlfolder, filename) for filename in listdir(xmlfolder) if \ for filename in listdir(xmlfolder):
filename.endswith('.xml')] if not filename.endswith('.xml'):
filenames.sort() continue
if not filenames: if filename in filenames:
raise DictConsistencyError(_('there is no XML file'), 77, [xmlfolder]) raise DictConsistencyError(_(f'duplicate xml file name {filename}'), 78, [xmlfolder])
for xmlfile in filenames: filenames[filename] = join(xmlfolder, filename)
try: if not filenames:
document = parse(xmlfile) raise DictConsistencyError(_('there is no XML file'), 77, [xmlfolder])
except XMLSyntaxError as err: file_names = list(filenames.keys())
raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err file_names.sort()
if not self.dtd.validate(document): for filename in file_names:
dtd_error = self.dtd.error_log.filter_from_errors()[0] xmlfile = filenames[filename]
msg = _(f'not a valid XML file: {dtd_error}') try:
raise DictConsistencyError(msg, 43, [xmlfile]) document = parse(xmlfile)
yield xmlfile, document.getroot() except XMLSyntaxError as err:
raise DictConsistencyError(_(f'not a XML file: {err}'), 52, [xmlfile]) from err
if not self.dtd.validate(document):
dtd_error = self.dtd.error_log.filter_from_errors()[0]
msg = _(f'not a valid XML file: {dtd_error}')
raise DictConsistencyError(msg, 43, [xmlfile])
yield xmlfile, document.getroot()

View File

@ -14,8 +14,8 @@ try:
from tiramisu3 import * from tiramisu3 import *
except: except:
from tiramisu import * from tiramisu import *
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -1,4 +1,2 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -
C /etc/file2 0644 root root - /usr/local/lib/etc/file2 C /etc/file2 0644 root root - /usr/local/lib/etc/file2
z /etc/file2 - - - - -

View File

@ -1,4 +1,2 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -
C /etc/file2 0644 root root - /usr/local/lib/etc/file2 C /etc/file2 0644 root root - /usr/local/lib/etc/file2
z /etc/file2 - - - - -

View File

@ -1,4 +1,2 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -
C /etc/file2 0644 root root - /usr/local/lib/etc/file2 C /etc/file2 0644 root root - /usr/local/lib/etc/file2
z /etc/file2 - - - - -

View File

@ -1,6 +1,3 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -
C /etc/file2 0644 root root - /usr/local/lib/etc/file2 C /etc/file2 0644 root root - /usr/local/lib/etc/file2
z /etc/file2 - - - - -
C /etc/dir/incfile 0644 root root - /usr/local/lib/etc/dir/incfile C /etc/dir/incfile 0644 root root - /usr/local/lib/etc/dir/incfile
z /etc/dir/incfile - - - - -

View File

@ -1,4 +1,2 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -
C /etc/file2 0644 root root - /usr/local/lib/etc/file2 C /etc/file2 0644 root root - /usr/local/lib/etc/file2
z /etc/file2 - - - - -

View File

@ -1,4 +1,2 @@
C /etc/systemd-makefs@dev-disk-by\x2dpartlabel 0644 root root - /usr/local/lib/etc/systemd-makefs@dev-disk-by\x2dpartlabel C /etc/systemd-makefs@dev-disk-by\x2dpartlabel 0644 root root - /usr/local/lib/etc/systemd-makefs@dev-disk-by\x2dpartlabel
z /etc/systemd-makefs@dev-disk-by\x2dpartlabel - - - - -
C /etc/systemd-makefs@dev-disk-by\x2dpartlabel2 0644 root root - /usr/local/lib/etc/systemd-makefs@dev-disk-by\x2dpartlabel2 C /etc/systemd-makefs@dev-disk-by\x2dpartlabel2 0644 root root - /usr/local/lib/etc/systemd-makefs@dev-disk-by\x2dpartlabel2
z /etc/systemd-makefs@dev-disk-by\x2dpartlabel2 - - - - -

View File

@ -1,2 +1 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -

View File

@ -1,2 +1 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -

View File

@ -1,2 +1 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -

View File

@ -1,2 +1 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -

View File

@ -1,4 +1,2 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -

View File

@ -1,2 +1 @@
C /etc/file 0644 root root - /usr/local/lib/etc/file C /etc/file 0644 root root - /usr/local/lib/etc/file
z /etc/file - - - - -

View File

@ -1,4 +1,2 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -

View File

@ -1,4 +1,2 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -

View File

@ -1,4 +1,2 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -

View File

@ -1,4 +1,2 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -

View File

@ -1,2 +1 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -

View File

@ -1,8 +1,4 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -
C /etc/mailname3 0644 root root - /usr/local/lib/etc/mailname3 C /etc/mailname3 0644 root root - /usr/local/lib/etc/mailname3
z /etc/mailname3 - - - - -
C /etc/mailname4 0644 root root - /usr/local/lib/etc/mailname4 C /etc/mailname4 0644 root root - /usr/local/lib/etc/mailname4
z /etc/mailname4 - - - - -

View File

@ -1,8 +1,4 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -
C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2
z /etc/mailname2 - - - - -
C /etc/mailname3 0644 root root - /usr/local/lib/etc/mailname3 C /etc/mailname3 0644 root root - /usr/local/lib/etc/mailname3
z /etc/mailname3 - - - - -
C /etc/mailname4 0644 root root - /usr/local/lib/etc/mailname4 C /etc/mailname4 0644 root root - /usr/local/lib/etc/mailname4
z /etc/mailname4 - - - - -

View File

@ -1,2 +1 @@
C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname
z /etc/mailname - - - - -