From 2de4a3abb8964cc581d3c4e2a4c59f0d91054dfb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= <filip.stromback@liu.se>
Date: Wed, 30 Sep 2020 15:38:41 +0200
Subject: [PATCH] Updated the validate script (for things with yum in them) and
 added an apply script for quicker testing.

---
 apply.sh    | 14 ++++++++++++++
 validate.sh |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100755 apply.sh

diff --git a/apply.sh b/apply.sh
new file mode 100755
index 0000000..f281202
--- /dev/null
+++ b/apply.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+modulepath="$(pwd)/.."
+
+set -x
+
+puppet parser validate --strict_variables --modulepath="$modulepath" manifests/
+
+for file in $*
+do
+    class=$(basename $file .pp)
+    # Sudo is needed for modules that do something with yum for example.
+    sudo /opt/puppetlabs/bin/puppet apply --test --modulepath="$modulepath" -e "include aes::$class"
+done
diff --git a/validate.sh b/validate.sh
index deee0a9..63c0eed 100755
--- a/validate.sh
+++ b/validate.sh
@@ -9,5 +9,6 @@ puppet parser validate --strict_variables --modulepath="$modulepath" manifests/
 for file in $*
 do
     class=$(basename $file .pp)
-    puppet apply --noop --test --modulepath="$modulepath" -e "include aes::$class"
+    # Sudo is needed for modules that do something with yum for example.
+    sudo /opt/puppetlabs/bin/puppet apply --noop --test --modulepath="$modulepath" -e "include aes::$class"
 done
-- 
GitLab