From 6f2644bd97db0d5a0adf83cd44632b46a09ed6a4 Mon Sep 17 00:00:00 2001
From: Thomas Johansson <thomas.johansson@liu.se>
Date: Sat, 19 Aug 2023 22:04:30 +0200
Subject: [PATCH] Test to replace exec for repo updates

---
 manifests/aes_sw.pp | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/manifests/aes_sw.pp b/manifests/aes_sw.pp
index 15cec34..761ca95 100644
--- a/manifests/aes_sw.pp
+++ b/manifests/aes_sw.pp
@@ -138,11 +138,26 @@ class aes::aes_sw {
     enable => true,
   }
 
-  exec { 'script-repo-updated':
-    command => "/opt/utils/update_repo.sh ${examadm_home}/scripts https://oauth2:iAyewr9Jq5E-tnsVrmbj@gitlab.liu.se/examadm/scripts.git master",
-    cwd     => $examadm_home,
-    user    => $examadm_user,
-    group   => $examadm_group,
+  # exec { 'script-repo-updated':
+  #   command => "/opt/utils/update_repo.sh ${examadm_home}/scripts https://oauth2:iAyewr9Jq5E-tnsVrmbj@gitlab.liu.se/examadm/scripts.git master",
+  #   cwd     => $examadm_home,
+  #   user    => $examadm_user,
+  #   group   => $examadm_group,
+  # }
+
+  # Test to replace exec for repo update //thojo16
+  vcsrepo { "${examadm_home}/scripts":
+    ensure   => latest,
+    provider => git,
+    source   => 'https://oauth2:iAyewr9Jq5E-tnsVrmbj@gitlab.liu.se/examadm/scripts.git',
+    revision => 'master',
+    owner    => $examadm_user,
+    group    => $examadm_group,
+    notify   => Exec['TriggeredByUpdates'],
+  }
+  exec { 'TriggeredByUpdates':
+    refreshonly => true,
+    command     => "touch ${examadm_home}/foo-vcsrepo",
   }
 
   schedule { 'everyday':
-- 
GitLab