From c76fea6f0f20571888e1e80e33dc0ea78aa28c2a Mon Sep 17 00:00:00 2001
From: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
Date: Sat, 6 Jan 2024 15:39:59 +0100
Subject: [PATCH] Move to setup_acceptance_node.pp

Rather than writing the setup code in Ruby, this is now written in
Puppet. That works better with modulesync. It also switches from the
legacy operatingsystem fact to the modern os.name fact. This is now
easily detectable with puppet-lint.
---
 .sync.yml                      |  2 ++
 spec/setup_acceptance_node.pp  | 15 +++++++++++++++
 spec/spec_helper_acceptance.rb | 15 ++++++---------
 3 files changed, 23 insertions(+), 9 deletions(-)
 create mode 100644 spec/setup_acceptance_node.pp

diff --git a/.sync.yml b/.sync.yml
index 130aaeb..ba4c369 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -1,4 +1,6 @@
 ---
+spec/spec_helper_acceptance.rb:
+  unmanaged: false
 .puppet-lint.rc:
   enabled_lint_checks:
     - parameter_documentation
diff --git a/spec/setup_acceptance_node.pp b/spec/setup_acceptance_node.pp
new file mode 100644
index 0000000..7977589
--- /dev/null
+++ b/spec/setup_acceptance_node.pp
@@ -0,0 +1,15 @@
+case $facts['os']['name'] {
+  'CentOS': {
+    # Mosquitto is packaged in EPEL
+    package { 'epel-release':
+      ensure => installed,
+    }
+  }
+  'Fedora': {
+    # For serverspec
+    package { 'iproute':
+      ensure => installed,
+    }
+  }
+  default: {}
+}
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 83f2075..2681792 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,13 +1,10 @@
 # frozen_string_literal: true
 
-# This file is completely managed via modulesync
+# Managed by modulesync - DO NOT EDIT
+# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
+
 require 'voxpupuli/acceptance/spec_helper_acceptance'
 
-configure_beaker do |host|
-  case fact_on(host, 'operatingsystem')
-  when 'CentOS'
-    host.install_package('epel-release')
-  when 'Fedora'
-    host.install_package('iproute')
-  end
-end
+configure_beaker(modules: :metadata)
+
+Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }