This commit is contained in:
mwiegand 2021-07-13 16:23:47 +02:00
parent 65ef24f403
commit 9db53faf23
2 changed files with 10 additions and 5 deletions

View file

@ -12,15 +12,15 @@ for name, unit in node.metadata.get('systemd/units').items():
extension = name.split('.')[-1]
if extension in ['netdev', 'network']:
files[f'/etc/systemd/network/{name}'] = {
'content': repo.libs.systemd.generate_unitfile(unit),
path = f'/etc/systemd/network/{name}'
dependencies = {
'triggers': [
'svc_systemd:systemd-networkd:restart',
],
}
elif extension in ['timer', 'service']:
files[f'/etc/systemd/system/{name}'] = {
'content': repo.libs.systemd.generate_unitfile(unit),
path = f'/etc/systemd/system/{name}'
dependencies = {
'triggers': [
"action:systemd-reload",
],
@ -28,6 +28,11 @@ for name, unit in node.metadata.get('systemd/units').items():
else:
raise Exception(f'unknown unit extension: "{extension}"')
files[path] = {
'content': repo.libs.systemd.generate_unitfile(unit),
**dependencies,
}
for name, config in node.metadata.get('systemd/services').items():
svc_systemd[name] = merge_dict(config, {
'needs': [

View file

@ -1,7 +1,7 @@
from mako.template import Template
template = '''
% for segment, options in data.items():
% for segment, options in sorted(data.items()):
% if '#' in segment:
# ${segment.split('#', 2)[1]}