From 3e961215538eab937ecfc94733e5e62b09223590 Mon Sep 17 00:00:00 2001
From: Matthias Hensler <matthias@wspse.de>
Date: Thu, 9 Sep 2021 12:52:37 +0200
Subject: [PATCH] Bugfix: remove duplicate defintion for
 Exec[network_restart_${name}]

if network::interface and network::mroute is used for the same
interface, and $restart_all_nics is false, the definition for
network_restart will be duplicated, using puppet to fail.

if you use
  network::mroute { 'static-eth0':
    interface => 'eth0'
    ...
  }
puppet will not complain, but create a "route-static-eth0"-file which
will not be pickuped by networkmanager.

So either move the exec-definition into a separate file (and use it from
with the interface.pp and mroute.pp manifest), or check if the
exec-definition was already defined, or (the way I choosed for now) use
a different name for the exec-ressource.
---
 manifests/mroute.pp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/manifests/mroute.pp b/manifests/mroute.pp
index 6f1ac44..0796f94 100644
--- a/manifests/mroute.pp
+++ b/manifests/mroute.pp
@@ -98,12 +98,12 @@ define network::mroute (
     default => $reload_command,
   }
   if $restart_all_nic == false and $::kernel == 'Linux' {
-    exec { "network_restart_${name}":
+    exec { "network_restart_route_${name}":
       command     => $real_reload_command,
       path        => '/sbin:/bin:/usr/sbin:/usr/bin',
       refreshonly => true,
     }
-    $network_notify = "Exec[network_restart_${name}]"
+    $network_notify = "Exec[network_restart_route_${name}]"
   } else {
     $network_notify = $network::manage_config_file_notify
   }
-- 
GitLab