]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(IAC-1741) Prefer 'installed' to 'present' for packages
authorRomain Tartière <romain@blogreen.org>
Thu, 26 Aug 2021 17:34:27 +0000 (07:34 -1000)
committerRomain Tartière <romain@blogreen.org>
Thu, 26 Aug 2021 17:38:28 +0000 (07:38 -1000)
stdlib 8.0.0 fixed this value for `ensure_package`, so we have to sync
with it.  While here, also use `installed` for package resources.

Because 'present' is still something that works, this is not a breaking
change.

manifests/linux.pp
spec/unit/classes/firewall_linux_debian_spec.rb
spec/unit/classes/firewall_linux_redhat_spec.rb
spec/unit/classes/firewall_linux_spec.rb

index ff984008792fd08899a380a0acefee5610976f3d..1ceadbe51024407b764e1cbce9acbf6ead0795b9 100644 (file)
@@ -7,7 +7,7 @@
 #   Controls the state of the ipv6 iptables service on your system. Valid options: 'running' or 'stopped'. Defaults to 'running'.
 #
 # @param pkg_ensure
-#   Controls the state of the iptables package on your system. Valid options: 'present' or 'latest'. Defaults to 'latest'.
+#   Controls the state of the iptables package on your system. Valid options: 'installed' or 'latest'. Defaults to 'latest'.
 #
 # @param service_name
 #   Specify the name of the IPv4 iptables service. Defaults defined in firewall::params.
@@ -26,7 +26,7 @@
 class firewall::linux (
   $ensure          = running,
   $ensure_v6       = undef,
-  $pkg_ensure      = present,
+  $pkg_ensure      = installed,
   $service_name    = $firewall::params::service_name,
   $service_name_v6 = $firewall::params::service_name_v6,
   $package_name    = $firewall::params::package_name,
index 4f74d21fb03c2e17d684eaa6bd53bdc07d0565cb..73833513328063bc2c1a7202c54fb31ffa063a3c 100644 (file)
@@ -14,7 +14,7 @@ describe 'firewall::linux::debian', type: :class do
 
     it {
       is_expected.to contain_package('iptables-persistent').with(
-        ensure: 'present',
+        ensure: 'installed',
       )
     }
     it {
@@ -54,7 +54,7 @@ describe 'firewall::linux::debian', type: :class do
 
     it {
       is_expected.to contain_package('iptables-persistent').with(
-        ensure: 'present',
+        ensure: 'installed',
       )
     }
     it {
@@ -94,7 +94,7 @@ describe 'firewall::linux::debian', type: :class do
 
     it {
       is_expected.to contain_package('iptables-persistent').with(
-        ensure: 'present',
+        ensure: 'installed',
       )
     }
     it {
@@ -134,7 +134,7 @@ describe 'firewall::linux::debian', type: :class do
 
     it {
       is_expected.to contain_package('netfilter-persistent').with(
-        ensure: 'present',
+        ensure: 'installed',
       )
     }
     it {
index d9b720da5ec2e1ecaa6f6f72838272a8f5bd3055..5055acb5258485851f185e69daa04826c5ad1770 100644 (file)
@@ -141,7 +141,7 @@ describe 'firewall::linux::redhat', type: :class do
 
         it {
           is_expected.to contain_package('iptables-services').with(
-            ensure: 'present',
+            ensure: 'installed',
             before: 'Service[iptables]',
           )
         }
@@ -209,14 +209,14 @@ describe 'firewall::linux::redhat', type: :class do
 
         it {
           is_expected.to contain_package('iptables-services').with(
-            ensure: 'present',
+            ensure: 'installed',
             before: ['Service[iptables]', 'Service[nftables]'],
           )
         }
 
         it {
           is_expected.to contain_package('nftables').with(
-            ensure: 'present',
+            ensure: 'installed',
             before: ['Service[iptables]', 'Service[nftables]'],
           )
         }
index b45982ea71fbf4a7e9aff7c49339eb7fbecd4fd8..42391040aaf342ba6c2f00ffe8871c7d8cb3a2df 100644 (file)
@@ -20,7 +20,7 @@ describe 'firewall::linux', type: :class do
           end
 
           it { is_expected.to contain_class('firewall::linux::redhat').with_require('Package[iptables]') }
-          it { is_expected.to contain_package('iptables').with_ensure('present') }
+          it { is_expected.to contain_package('iptables').with_ensure('installed') }
         end
       end
     end
@@ -42,7 +42,7 @@ describe 'firewall::linux', type: :class do
         end
 
         it { is_expected.to contain_class('firewall::linux::debian').with_require('Package[iptables]') }
-        it { is_expected.to contain_package('iptables').with_ensure('present') }
+        it { is_expected.to contain_package('iptables').with_ensure('installed') }
       end
     end
   end