Skip to content

Commit

Permalink
cli/generate: skip daemon_reload with --mapping
Browse files Browse the repository at this point in the history
When --mapping is used, nothing is generated so there is no need for
calling daemon-reload.
  • Loading branch information
daniloegea authored and slyon committed May 16, 2024
1 parent a22b350 commit ea60510
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions netplan_cli/cli/commands/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ def command_generate(self):
res = subprocess.call(argv)
# reload systemd, as we might have changed service units, such as
# /run/systemd/system/systemd-networkd-wait-online.service.d/10-netplan.conf
try:
utils.systemctl_daemon_reload()
except subprocess.CalledProcessError as e:
logging.warning(e)
# Skip it if --mapping is used as nothing will be generated
if self.mapping is None:
try:
utils.systemctl_daemon_reload()
except subprocess.CalledProcessError as e:
logging.warning(e)
# FIXME: os.execv(argv[0], argv) would be better but fails coverage
sys.exit(res)

0 comments on commit ea60510

Please sign in to comment.