commit 948ebc9830ddefa7efe0f10e619bd50f10a051d4
Author: Nacho Barrientos <nacho.barrientos@cern.ch>
Date:   Wed Dec 9 18:38:40 2020 +0100

    Prefix custom tables with custom- so they're loaded

diff --git a/manifests/config.pp b/manifests/config.pp
index 21cdffc..3c502e9 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -3,6 +3,7 @@ define nftables::config (
   Pattern[/^\w+-\w+$/] $tablespec = $title,
   Optional[String] $content = undef,
   Optional[Variant[String,Array[String,1]]] $source = undef,
+  String $prefix = 'custom-',
 ) {
   if $content and $source {
     fail('Please pass only $content or $source, not both.')
@@ -12,15 +13,15 @@ define nftables::config (
 
   Package['nftables'] -> concat {
     $concat_name:
-      path           => "/etc/nftables/puppet-preflight/${name}.nft",
+      path           => "/etc/nftables/puppet-preflight/${prefix}${name}.nft",
       ensure_newline => true,
       owner          => root,
       group          => root,
       mode           => '0640',
   } ~> Exec['nft validate'] -> file {
-    "/etc/nftables/puppet/${name}.nft":
+    "/etc/nftables/puppet/${prefix}${name}.nft":
       ensure => file,
-      source => "/etc/nftables/puppet-preflight/${name}.nft",
+      source => "/etc/nftables/puppet-preflight/${prefix}${name}.nft",
       owner  => root,
       group  => root,
       mode   => '0640',
diff --git a/manifests/inet_filter.pp b/manifests/inet_filter.pp
index 133f073..c8d9d23 100644
--- a/manifests/inet_filter.pp
+++ b/manifests/inet_filter.pp
@@ -9,6 +9,7 @@ class nftables::inet_filter inherits nftables {
 
   nftables::config {
     'inet-filter':
+      prefix => '',
       source => 'puppet:///modules/nftables/config/puppet-inet-filter.nft';
   }
 
diff --git a/manifests/ip_nat.pp b/manifests/ip_nat.pp
index 8ffe53f..68d66c7 100644
--- a/manifests/ip_nat.pp
+++ b/manifests/ip_nat.pp
@@ -1,6 +1,11 @@
 # manage basic chains in table ip nat
 class nftables::ip_nat inherits nftables {
-  nftables::config { ['ip-nat', 'ip6-nat']: }
+  nftables::config {
+    'ip-nat':
+      prefix => '';
+    'ip6-nat':
+      prefix => '';
+  }
 
   nftables::chain {
     [
diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb
index fca5a7f..9c69567 100644
--- a/spec/defines/config_spec.rb
+++ b/spec/defines/config_spec.rb
@@ -15,16 +15,16 @@ describe 'nftables::config' do
         it { is_expected.to contain_concat('nftables-FOO-BAR') }
         it {
           is_expected.to contain_concat('nftables-FOO-BAR').with(
-            path: '/etc/nftables/puppet-preflight/FOO-BAR.nft',
+            path: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft',
             ensure_newline: true,
             mode: '0640',
           )
         }
-        it { is_expected.to contain_file('/etc/nftables/puppet/FOO-BAR.nft') }
+        it { is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft') }
         it {
-          is_expected.to contain_file('/etc/nftables/puppet/FOO-BAR.nft').with(
+          is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft').with(
             ensure: 'file',
-            source: '/etc/nftables/puppet-preflight/FOO-BAR.nft',
+            source: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft',
             mode: '0640',
           )
         }
@@ -74,16 +74,16 @@ describe 'nftables::config' do
         it { is_expected.to contain_concat('nftables-FOO-BAR') }
         it {
           is_expected.to contain_concat('nftables-FOO-BAR').with(
-            path: '/etc/nftables/puppet-preflight/FOO-BAR.nft',
+            path: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft',
             ensure_newline: true,
             mode: '0640',
           )
         }
-        it { is_expected.to contain_file('/etc/nftables/puppet/FOO-BAR.nft') }
+        it { is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft') }
         it {
-          is_expected.to contain_file('/etc/nftables/puppet/FOO-BAR.nft').with(
+          is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft').with(
             ensure: 'file',
-            source: '/etc/nftables/puppet-preflight/FOO-BAR.nft',
+            source: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft',
             mode: '0640',
           )
         }
