]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
add extra configuration
authoradrianiurca <adrian.iurca@gmail.com>
Mon, 1 Mar 2021 11:46:47 +0000 (13:46 +0200)
committeradrianiurca <adrian.iurca@gmail.com>
Mon, 1 Mar 2021 11:46:47 +0000 (13:46 +0200)
spec/acceptance/firewall_attributes_exceptions_spec.rb
spec/acceptance/firewall_attributes_happy_path_spec.rb
spec/acceptance/rules_spec.rb
spec/spec_helper_acceptance_local.rb

index 67e59c2aa2d544d5e767bfc818b7f2258f5aaa13..b95891584544f29de35b2349021127b35a776409 100644 (file)
@@ -6,8 +6,6 @@ describe 'firewall basics', docker: true do
   before :all do
     if os[:family] == 'ubuntu' || os[:family] == 'debian'
       update_profile_file
-    elsif os[:family] == 'redhat'
-      pre_setup
     end
     iptables_flush_all_tables
     ip6tables_flush_all_tables
index dedc9be294eef13d10aa026f9164af7c09e82e86..65a73e97e9f14c4dd857188c86b8e0114fdd1c93 100644 (file)
@@ -4,9 +4,6 @@ require 'spec_helper_acceptance'
 
 describe 'firewall attribute testing, happy path' do
   before :all do
-    if os[:family] == 'redhat'
-      pre_setup
-    end
     iptables_flush_all_tables
     ip6tables_flush_all_tables
   end
index 5b5dfeb07f8193accaaeb65e83d535ab1afb8dcc..9a0c62e3a5c515acf0a87255f23fe6adad92469b 100644 (file)
@@ -6,9 +6,6 @@ require 'spec_helper_acceptance_local'
 describe 'rules spec' do
   describe 'complex ruleset 1' do
     before :all do
-      if os[:family] == 'redhat'
-        pre_setup
-      end
       iptables_flush_all_tables
       ip6tables_flush_all_tables
     end
index 461a9a8e3f322702342697847b7fac1930466452..b6a5417a19945f3b9cdc6a420fc0f3229588780b 100644 (file)
@@ -22,11 +22,16 @@ end
 def install_iptables
   LitmusHelper.instance.run_shell('iptables -V')
 rescue
-  if os[:family] == 'redhat'
-    LitmusHelper.instance.run_shell('yum install iptables-services -y')
-  else
-    LitmusHelper.instance.run_shell('apt-get install iptables -y')
-  end
+  install_pp = <<-PUPPETCODE
+    $iptables_package_name = $facts['os']['family'] ? {
+      'RedHat' => 'iptables-services',
+      default  => 'iptables',
+    }
+    package { $iptables_package_name:
+      ensure => 'latest',
+    }
+  PUPPETCODE
+  LitmusHelper.instance.apply_manifest(install_pp)
 end
 
 def iptables_version
@@ -55,7 +60,7 @@ RSpec.configure do |c|
   # To enable tests on abs/vmpooler machines just set to `true` this flag
   c.filter_run_excluding condition_parameter_test: false
   c.before :suite do
-    if fetch_os_name == 'centos' && os[:release].to_i == 8
+    if os[:family] == 'redhat'
       pp = <<-PUPPETCODE
         package { 'iptables-services':
           ensure => 'latest',
@@ -65,11 +70,15 @@ RSpec.configure do |c|
         }
       PUPPETCODE
       LitmusHelper.instance.apply_manifest(pp)
+      LitmusHelper.instance.run_shell('yum install system-config-firewall-base -y')
+      LitmusHelper.instance.run_shell('lokkit --default=server')
+      LitmusHelper.instance.run_shell('service ip6tables restart')
+      pre_setup
     end
     if os[:family] == 'debian' && os[:release].to_i == 10
       pp = <<-PUPPETCODE
         package { 'net-tools':
-          ensure   => 'latest',
+          ensure => 'latest',
         }
         PUPPETCODE
       LitmusHelper.instance.apply_manifest(pp)