From 85d465a42b0398c909e18d28ed49380efdc07f43 Mon Sep 17 00:00:00 2001 From: Andre Fernando Zanella Kantek Date: Thu, 31 Mar 2022 09:52:11 -0300 Subject: [PATCH] Set directory path variable names unique for Debian on puppet-network It was observed in some debian installations that the value of SCRIPT_DIRECTORY was /etc/sysconfig/network instead of /var/run/network-scripts.puppet/. This was caused due to the fact that the file redhat.rb on the puppet-network plugin also is declaring a SCRIPT_DIRECTORY string with freeze and, depending on how the system was loading, this module it would overwrite the value set in interfaces.rb (used for Debian). This corrections make the variable names unique on the debian files, interfaces.rb and routes.rb, to prevent them to be overwitten Test plan PASS Debian installation done on virtualbox PASS host unlock with correct network configuration after reboot Story: 2009101 Task: 44908 Signed-off-by: Andre Fernando Zanella Kantek Change-Id: I30c9d16f824bfd42854717d743f0c9d9e9bf3eb2 --- ...ir-path-variable-with-distinct-names.patch | 81 +++++++++++++++++++ .../debian/deb_folder/patches/series | 3 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 config/puppet-modules/puppet-network/debian/deb_folder/patches/0004-Save-dir-path-variable-with-distinct-names.patch diff --git a/config/puppet-modules/puppet-network/debian/deb_folder/patches/0004-Save-dir-path-variable-with-distinct-names.patch b/config/puppet-modules/puppet-network/debian/deb_folder/patches/0004-Save-dir-path-variable-with-distinct-names.patch new file mode 100644 index 000000000..f3caa42db --- /dev/null +++ b/config/puppet-modules/puppet-network/debian/deb_folder/patches/0004-Save-dir-path-variable-with-distinct-names.patch @@ -0,0 +1,81 @@ +From eec5204aeed0eb839d2328732b5515061cc00e79 Mon Sep 17 00:00:00 2001 +From: Andre Fernando Zanella Kantek + +Date: Thu, 31 Mar 2022 08:08:22 -0300 +Subject: [PATCH] Save dir path variable with distinct names + +Signed-off-by: Andre Fernando Zanella Kantek +--- + lib/puppet/provider/network_config/interfaces.rb | 10 +++++----- + lib/puppet/provider/network_route/routes.rb | 10 +++++----- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/lib/puppet/provider/network_config/interfaces.rb b/lib/puppet/provider/network_config/interfaces.rb +index f16d082..487b243 100644 +--- a/lib/puppet/provider/network_config/interfaces.rb ++++ b/lib/puppet/provider/network_config/interfaces.rb +@@ -23,15 +23,15 @@ Puppet::Type.type(:network_config).provide(:interfaces) do + # /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_DIRECTORY = '/var/run/network-scripts.puppet/' +- SCRIPT_FILE = SCRIPT_DIRECTORY + 'interfaces' ++ SCRIPT_INTERFACES_DEB_DIRECTORY = '/var/run/network-scripts.puppet/'.freeze ++ SCRIPT_INTERFACES_DEB_FILE = SCRIPT_INTERFACES_DEB_DIRECTORY + 'interfaces' + + def select_file +- SCRIPT_FILE ++ SCRIPT_INTERFACES_DEB_FILE + end + + def self.target_files +- [SCRIPT_FILE] ++ [SCRIPT_INTERFACES_DEB_FILE] + end + + class MalformedInterfacesError < Puppet::Error +@@ -255,7 +255,7 @@ Puppet::Type.type(:network_config).provide(:interfaces) do + + # Generate an array of sections + def self.format_file(_filename, providers) +- Dir.mkdir(SCRIPT_DIRECTORY) unless File.exists?(SCRIPT_DIRECTORY) ++ Dir.mkdir(SCRIPT_INTERFACES_DEB_DIRECTORY) unless File.exists?(SCRIPT_INTERFACES_DEB_DIRECTORY) + + contents = [] + contents << header +diff --git a/lib/puppet/provider/network_route/routes.rb b/lib/puppet/provider/network_route/routes.rb +index 9f7b40c..0575a2a 100644 +--- a/lib/puppet/provider/network_route/routes.rb ++++ b/lib/puppet/provider/network_route/routes.rb +@@ -28,15 +28,15 @@ Puppet::Type.type(:network_route).provide(:routes) do + # /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' ++ SCRIPT_ROUTES_DEB_DIRECTORY = '/var/run/network-scripts.puppet/'.freeze ++ SCRIPT_ROUTES_DEB_FILE = SCRIPT_ROUTES_DEB_DIRECTORY + 'routes' + + def select_file +- SCRIPT_ROUTES_FILE ++ SCRIPT_ROUTES_DEB_FILE + end + + def self.target_files +- [SCRIPT_ROUTES_FILE] ++ [SCRIPT_ROUTES_DEB_FILE] + end + + class MalformedRoutesError < Puppet::Error +@@ -93,7 +93,7 @@ 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) ++ Dir.mkdir(SCRIPT_ROUTES_DEB_DIRECTORY) unless File.exists?(SCRIPT_ROUTES_DEB_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 41f65ce73..13f07067c 100644 --- a/config/puppet-modules/puppet-network/debian/deb_folder/patches/series +++ b/config/puppet-modules/puppet-network/debian/deb_folder/patches/series @@ -1,3 +1,4 @@ 0001-save-result-file-to-var-run-network-to-allow-manipul.patch 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 +0003-set-routes-file-to-var-run-network-scripts.puppet.patch +0004-Save-dir-path-variable-with-distinct-names.patch \ No newline at end of file