Skip to content

Commit

Permalink
Listen module-removed event
Browse files Browse the repository at this point in the history
If Samba gets removed, DNS service can be enabled again.
  • Loading branch information
DavidePrincipi committed Dec 11, 2024
1 parent 31a30a8 commit 226023c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions imageroot/events/module-removed/10restart_dnsmasq
Original file line number Diff line number Diff line change
@@ -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'))

0 comments on commit 226023c

Please sign in to comment.