razorsedge / puppet-network

Puppet module to manage Red Hat/Fedora traditional network configuration.
http://forge.puppetlabs.com/razorsedge/network
Other
55 stars 140 forks source link

Enable using ifscripts for alias resources; allow setting ifcfg resources to absent (remove file) #133

Open esalberg opened 6 years ago

esalberg commented 6 years ago

Create a parameter to allow using the ifup / ifdown scripts for alias resources only (less disruptive than a full network restart). Allow removal of ifcfg file for aliases when ensure is set to absent.

esalberg commented 6 years ago

I have a branch that combines both restarts and ifscripts into one, if that would be helpful. I didn't know if you'd want the functionality split into two PRs.

jsfrerot commented 6 years ago

I had to replace the following code to make it work on my setup. in centos7 the ":" is replaced by "_" in interfaces fact.

--- a/modules/network/manifests/init.pp
+++ b/modules/network/manifests/init.pp
@@ -205,7 +205,7 @@ define network_if_base (
   }

   if $ifscripts {
-    if ! ($interface in $::interfaces) {
+    if ! (regsubst($interface, ':', '_') in $::interfaces) {
       $refreshonly_ifscripts = undef
     }
     else {
cropalato commented 6 years ago

In my case puppet doesn't replace ':' by '_' in $::interfaces. So should be safe have both conditions like:

--- a/modules/network/manifests/init.pp +++ b/modules/network/manifests/init.pp @@ -205,7 +205,7 @@ define network_if_base ( }

if $ifscripts {