commit 0c9bc3084e3f6ee8dbbd9e2c8d3564fb150ee61d
Author: hashworks <mail@hashworks.net>
Date:   Sat Feb 26 16:48:35 2022 +0100

    Add support for Arch Linux
    
    Arch Linux stores the configuration in a different path and does not
    provide firewalld without explicit installation.
    
    This basically the same as #66 – I've reused their code since it hasn't
    been merged in a while.

diff --git a/spec/acceptance/default_spec.rb b/spec/acceptance/default_spec.rb
index d0f4fe4..fac6da7 100644
--- a/spec/acceptance/default_spec.rb
+++ b/spec/acceptance/default_spec.rb
@@ -11,6 +11,14 @@ describe 'nftables class' do
       class { 'nftables':
         firewalld_enable => false,
       }
+      $config_path = case $facts['os']['family'] {
+        'Archlinux': {
+          '/etc/nftables.conf'
+        }
+        default: {
+          '/etc/sysconfig/nftables.conf'
+        }
+      }
       # nftables cannot be started in docker so replace service with a validation only.
       systemd::dropin_file{"zzz_docker_nft.conf":
         ensure  => present,
@@ -18,9 +26,9 @@ describe 'nftables class' do
         content => [
           "[Service]",
           "ExecStart=",
-          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "ExecReload=",
-          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "",
           ].join("\n"),
         notify  => Service["nftables"],
@@ -58,6 +66,14 @@ describe 'nftables class' do
       nftables::rule{'default_out-junk':
         content => 'A load of junk',
       }
+      $config_path = case $facts['os']['family'] {
+        'Archlinux': {
+          '/etc/nftables.conf'
+        }
+        default: {
+          '/etc/sysconfig/nftables.conf'
+        }
+      }
       # nftables cannot be started in docker so replace service with a validation only.
       systemd::dropin_file{"zzz_docker_nft.conf":
         ensure  => present,
@@ -65,9 +81,9 @@ describe 'nftables class' do
         content => [
           "[Service]",
           "ExecStart=",
-          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "ExecReload=",
-          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "",
           ].join("\n"),
         notify  => Service["nftables"],
@@ -90,6 +106,14 @@ describe 'nftables class' do
         inet_filter => false,
         nat => false,
       }
+      $config_path = case $facts['os']['family'] {
+        'Archlinux': {
+          '/etc/nftables.conf'
+        }
+        default: {
+          '/etc/sysconfig/nftables.conf'
+        }
+      }
       # nftables cannot be started in docker so replace service with a validation only.
       systemd::dropin_file{"zzz_docker_nft.conf":
         ensure  => present,
@@ -97,9 +121,9 @@ describe 'nftables class' do
         content => [
           "[Service]",
           "ExecStart=",
-          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "ExecReload=",
-          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "",
           ].join("\n"),
         notify  => Service["nftables"],
@@ -122,6 +146,14 @@ describe 'nftables class' do
         nat => true,
         nat_table_name => 'mycustomtablename',
       }
+      $config_path = case $facts['os']['family'] {
+        'Archlinux': {
+          '/etc/nftables.conf'
+        }
+        default: {
+          '/etc/sysconfig/nftables.conf'
+        }
+      }
       # nftables cannot be started in docker so replace service with a validation only.
       systemd::dropin_file{"zzz_docker_nft.conf":
         ensure  => present,
@@ -129,9 +161,9 @@ describe 'nftables class' do
         content => [
           "[Service]",
           "ExecStart=",
-          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecStart=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "ExecReload=",
-          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f /etc/sysconfig/nftables.conf",
+          "ExecReload=/sbin/nft -c -I /etc/nftables/puppet -f $config_path",
           "",
           ].join("\n"),
         notify  => Service["nftables"],
