Skip to content

hook: align restart flow with default_hook.sh#952

Merged
sknat merged 1 commit intomasterfrom
abasu-fix-hook
Mar 6, 2026
Merged

hook: align restart flow with default_hook.sh#952
sknat merged 1 commit intomasterfrom
abasu-fix-hook

Conversation

@aritrbas
Copy link
Collaborator

@aritrbas aritrbas commented Mar 6, 2026

NetworkManagerHook had drifted from default_hook.sh by running systemctl daemon-reload before every service restart.
That made restartNetwork() perform extra reloads for systemd-networkd/NetworkManager/etc.

This PR scopes systemctl daemon-reload to the DNS mutation paths (fixDNS and undoDNSFix) and tweakNetworkFile() matching the shell script. restartService() now only restarts the target service. A new function reloadAndRestartService() has been added to handle "reload+restart" when needed. This should restore behavior parity with default_hook.sh.

- remove "daemon-reload" from generic restartService()
  to avoid reloads on every network restart
- keep "daemon-reload" only for NetworkManager DNS fix
  and undo fix via reloadAndRestartService()

Signed-off-by: Aritra Basu <aritrbas@cisco.com>
@aritrbas aritrbas self-assigned this Mar 6, 2026
@sknat sknat merged commit 5a853cb into master Mar 6, 2026
5 checks passed
@aritrbas aritrbas deleted the abasu-fix-hook branch March 6, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants