From 712a7fefd062be0f1a7099d7d8bb8b464f22aaec Mon Sep 17 00:00:00 2001
From: Hans Persson <hans@nsc.liu.se>
Date: Tue, 18 Jan 2022 16:30:26 +0100
Subject: [PATCH] Adjust arc::voms to accomodate changes from babylon.

Split out the installation of the voms and wlcg-repo packages to
the separate class arc::voms::repoinstall and then instantiate
that from arc::voms, but using the repoinstall stage. This means
that we are guaranteed that the repo is installed before anything
attempts to use it (since it's in a completely different
installation stage), and thus we can remove a few now-unnecessary
require lines.

Add the package wlcg-voms-alice which is needed by babylon and
won't do any harm being installed on bluegrass either.

Clean up the manual creation of an extra VO since we don't need
most of the require lines here (see above). Since the code is
written in the non-recommended style of several resouces being
handled in the same file statement we need to tinker with lines
that we didn't really modify as well.
---
 manifests/voms.pp             | 31 ++++++++++++-------------------
 manifests/voms/repoinstall.pp |  9 +++++++++
 2 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 manifests/voms/repoinstall.pp

diff --git a/manifests/voms.pp b/manifests/voms.pp
index 7c216a2..bab4d6b 100644
--- a/manifests/voms.pp
+++ b/manifests/voms.pp
@@ -11,22 +11,17 @@
 
 class arc::voms
 {
-    package {
-	# Install the basic voms package
-        'voms':
-            ensure => installed;
-
-        # Set up the WLCG repo
-        'wlcg-repo':
-            ensure => installed,
-            require => Package['voms'],
-            tag => 'pkgrepo';
+    # Install required repo.
+    include stages
+    class { 'arc::voms::repoinstall':
+        stage => 'repoinstall',
+    }
 
-	# Install voms files
-        [ 'wlcg-voms-ops', 'wlcg-voms-atlas', 'wlcg-voms-dteam',
-	  'wlcg-iam-lsc-alice', 'wlcg-iam-lsc-atlas' ]:
-            ensure => installed,
-            require => Package['wlcg-repo'];
+    # Install voms files.
+    package { [ 'wlcg-voms-ops', 'wlcg-voms-atlas',
+                'wlcg-voms-alice', 'wlcg-voms-dteam',
+                'wlcg-iam-lsc-alice', 'wlcg-iam-lsc-atlas' ]:
+        ensure => installed,
     }
 
     # Some VO:s doesn't have nice packages. Create those manually.
@@ -34,15 +29,13 @@ class arc::voms
         # vo.hess-experiment.eu
         '/etc/grid-security/vomsdir/vo.hess-experiment.eu':
 	    ensure => directory,
-	    owner => 'root', group => 'root', mode => '0555',
-	    require => Package['voms'];
+	    owner => 'root', group => 'root', mode => '0555';
         '/etc/grid-security/vomsdir/vo.hess-experiment.eu/grid12.lal.in2p3.fr.lsc':
 	    source => 'puppet:///modules/arc/grid12.lal.in2p3.fr.lsc',
 	    owner => 'root', group => 'root', mode => '0444',
 	    require => File['/etc/grid-security/vomsdir/vo.hess-experiment.eu'];
         '/etc/vomses/vo.hess-experiment.eu':
 	    source => 'puppet:///modules/arc/vo.hess-experiment.eu',
-	    owner => 'root', group => 'root', mode => '0444',
-	    require => Package['voms'];
+	    owner => 'root', group => 'root', mode => '0444';
     }
 }
diff --git a/manifests/voms/repoinstall.pp b/manifests/voms/repoinstall.pp
new file mode 100644
index 0000000..70128c7
--- /dev/null
+++ b/manifests/voms/repoinstall.pp
@@ -0,0 +1,9 @@
+class arc::voms::repoinstall
+{
+    package { 'voms': ensure => installed, }
+
+    package { 'wlcg-repo':
+        ensure  => installed,
+        require => Package['voms'],
+    }
+}
-- 
GitLab