puppet-network icon indicating copy to clipboard operation
puppet-network copied to clipboard

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

Open esalberg opened this issue 7 years ago • 3 comments

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 avatar Oct 17 '17 20:10 esalberg

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.

esalberg avatar Oct 17 '17 20:10 esalberg

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 {

jsfrerot avatar Mar 28 '18 11:03 jsfrerot

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 {

  • if ! (regsubst($interface, ':', '_') in $::interfaces) {
  • if ! ((regsubst($interface, ':', '_') in $::interfaces) or ($interface in $::interfaces)){ $refreshonly_ifscripts = undef } else {

cropalato avatar Aug 02 '18 13:08 cropalato