From 11cc1482ca79c36a26e3f275564fd0f9d8d24758 Mon Sep 17 00:00:00 2001 From: Andre Fernando Zanella Kantek Date: Wed, 9 Mar 2022 13:20:55 -0300 Subject: [PATCH] Change default location of puppet-network routes file on Debian In order to compare the difference between sysinv database and currently configured static routes, the destination directory will be changed to /var/run/network-scripts.puppet/ This new location will be used by apply_network_config script to update modified configuration from the database and save the result in /etc/network/routes be used during boot by ifupdown Story: 2009101 Task: 44728 Signed-off-by: Andre Fernando Zanella Kantek Change-Id: I4ba06160c2cc7db2bfec061c09b9eb6a75961ce4 --- ...le-to-var-run-network-scripts.puppet.patch | 49 +++++++++++++++++++ .../debian/deb_folder/patches/series | 3 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 config/puppet-modules/puppet-network/debian/deb_folder/patches/0003-set-routes-file-to-var-run-network-scripts.puppet.patch diff --git a/config/puppet-modules/puppet-network/debian/deb_folder/patches/0003-set-routes-file-to-var-run-network-scripts.puppet.patch b/config/puppet-modules/puppet-network/debian/deb_folder/patches/0003-set-routes-file-to-var-run-network-scripts.puppet.patch new file mode 100644 index 000000000..776b9780d --- /dev/null +++ b/config/puppet-modules/puppet-network/debian/deb_folder/patches/0003-set-routes-file-to-var-run-network-scripts.puppet.patch @@ -0,0 +1,49 @@ +From 2ee2caf0b72ae54341934933c23d80c9a1b4e244 Mon Sep 17 00:00:00 2001 +From: Andre Fernando Zanella Kantek + +Date: Wed, 9 Mar 2022 09:59:06 -0300 +Subject: [PATCH] set routes file to /var/run/network-scripts.puppet + +Signed-off-by: Andre Fernando Zanella Kantek +--- + lib/puppet/provider/network_route/routes.rb | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/lib/puppet/provider/network_route/routes.rb b/lib/puppet/provider/network_route/routes.rb +index 290bb4d..9f7b40c 100644 +--- a/lib/puppet/provider/network_route/routes.rb ++++ b/lib/puppet/provider/network_route/routes.rb +@@ -24,12 +24,19 @@ Puppet::Type.type(:network_route).provide(:routes) do + + has_feature :provider_options + ++ # WRS: Generate temporary copy. It will get compared to file ++ # /etc/network/interfaces afterward. Only config that have changed ++ # will get replaced. Don't let puppet directly manage it, else it will ++ # trigger un-wanted networking actions (like up/down). ++ SCRIPT_ROUTES_DIRECTORY = '/var/run/network-scripts.puppet/' ++ SCRIPT_ROUTES_FILE = SCRIPT_ROUTES_DIRECTORY + 'routes' ++ + def select_file +- '/etc/network/routes' ++ SCRIPT_ROUTES_FILE + end + + def self.target_files +- ['/etc/network/routes'] ++ [SCRIPT_ROUTES_FILE] + end + + class MalformedRoutesError < Puppet::Error +@@ -86,6 +93,8 @@ Puppet::Type.type(:network_route).provide(:routes) do + + # Generate an array of sections + def self.format_file(_filename, providers) ++ Dir.mkdir(SCRIPT_ROUTES_DIRECTORY) unless File.exists?(SCRIPT_ROUTES_DIRECTORY) ++ + contents = [] + contents << header + +-- +2.17.1 + diff --git a/config/puppet-modules/puppet-network/debian/deb_folder/patches/series b/config/puppet-modules/puppet-network/debian/deb_folder/patches/series index c15dcf1af..41f65ce73 100644 --- a/config/puppet-modules/puppet-network/debian/deb_folder/patches/series +++ b/config/puppet-modules/puppet-network/debian/deb_folder/patches/series @@ -1,2 +1,3 @@ 0001-save-result-file-to-var-run-network-to-allow-manipul.patch -0002-set-provider-mode-when-formatting-interfaces-file.patch \ No newline at end of file +0002-set-provider-mode-when-formatting-interfaces-file.patch +0003-set-routes-file-to-var-run-network-scripts.puppet.patch \ No newline at end of file