From 46ec08e58419bb73bf49b44cf32fa3d304236615 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Thu, 5 Oct 2017 13:33:12 -0500 Subject: [PATCH 1/1] permit inservice update of static routes --- .../network/lib/puppet/provider/network_route/redhat.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb b/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb index 7123d44..5073519 100644 --- a/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb +++ b/packstack/puppet/modules/network/lib/puppet/provider/network_route/redhat.rb @@ -18,12 +18,18 @@ Puppet::Type.type(:network_route).provide(:redhat) do has_feature :provider_options + # WRS: Generate temporary copies. It will get compared to files under + # /etc/sysconfig/network-scripts afterward. Only config that have changed + # will get replaced. Don't let puppet directly manage them, else it will + # trigger un-wanted networking actions (like up/down). + RSCRIPT_DIRECTORY = "/var/run/network-scripts.puppet" + def select_file - "/etc/sysconfig/network-scripts/route-#{@resource[:interface]}" + "#{RSCRIPT_DIRECTORY}/route-#{@resource[:interface]}" end def self.target_files - Dir["/etc/sysconfig/network-scripts/route-*"] + Dir["#{RSCRIPT_DIRECTORY}/route-*"] end def self.parse_file(filename, contents) @@ -76,6 +82,7 @@ Puppet::Type.type(:network_route).provide(:redhat) do # Generate an array of sections def self.format_file(filename, providers) + Dir.mkdir(RSCRIPT_DIRECTORY) unless File.exists?(RSCRIPT_DIRECTORY) contents = [] contents << header # Build routes @@ -103,4 +110,9 @@ Puppet::Type.type(:network_route).provide(:redhat) do HEADER str end + + def self.post_flush_hook(filename) + File.chmod(0644, filename) + end + end -- 1.8.3.1