From 9b8a235ab12bf89966af6590121a2daa2a80e9ef Mon Sep 17 00:00:00 2001 From: Davide Principi Date: Wed, 11 Dec 2024 18:15:17 +0100 Subject: [PATCH] Listen module-removed event If Samba gets removed, DNS service can be enabled again. --- .../events/module-removed/10restart_dnsmasq | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 imageroot/events/module-removed/10restart_dnsmasq diff --git a/imageroot/events/module-removed/10restart_dnsmasq b/imageroot/events/module-removed/10restart_dnsmasq new file mode 100755 index 0000000..8161653 --- /dev/null +++ b/imageroot/events/module-removed/10restart_dnsmasq @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +# +# Copyright (C) 2024 Nethesis S.r.l. +# SPDX-License-Identifier: GPL-3.0-or-later +# + +import json +import os +import sys + +import agent + +data = json.load(sys.stdin) + +# skip if the event comes from another node +if os.environ['NODE_ID'] != str(data['node']): + sys.exit(0) + +agent.run_helper('systemctl', 'restart', os.getenv('MODULE_ID'))