diff --git a/files/broker/on_update.sh b/files/broker/on_update.sh index 1e6a62c2563fc353ed58fd4c00cb75e0d90d9409..f8a957941eb2bffd4ee517529d25fde67b1c0037 100644 --- a/files/broker/on_update.sh +++ b/files/broker/on_update.sh @@ -1,6 +1,5 @@ #!/bin/bash -run_as_broker=$(cat <<'EOF' cd # To make sure we have a decent GCC in our path. source /opt/rh/devtoolset-7/enable @@ -17,12 +16,4 @@ cd mkdir -p bin/ rm -f bin/broker cp src/broker/broker bin/ -EOF -) - -# Compile as "broker". -sudo --user broker --group broker --set-home -- bash -c "$run_as_broker" - -# Then, we can restart the services. -systemctl restart aes_broker.service diff --git a/manifests/aes_sw.pp b/manifests/aes_sw.pp index f3b109a22993e4e4cdaed3a77ea2fba36f631f64..54b18b24cde3efbe0dad67f774405e51dbb5fe96 100644 --- a/manifests/aes_sw.pp +++ b/manifests/aes_sw.pp @@ -138,13 +138,6 @@ 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, - # } - # Test to replace exec for repo update //thojo16 vcsrepo { "${examadm_home}/scripts": ensure => latest, @@ -153,12 +146,6 @@ class aes::aes_sw { revision => 'master', owner => $examadm_user, group => $examadm_group, - notify => Exec['TriggeredByUpdates'], - } - exec { 'TriggeredByUpdates': - path => '/bin/:/usr/bin/', - command => "touch ${examadm_home}/foo-vcsrepo", - refreshonly => true, } schedule { 'everyday': diff --git a/manifests/auth.pp b/manifests/auth.pp index 5e4c4329443a483f51abc7f06061a526979fecca..6b581ce273b0f513bccfd6b4018e07dd87b21f3d 100644 --- a/manifests/auth.pp +++ b/manifests/auth.pp @@ -141,10 +141,10 @@ class aes::auth ( group => $auth_group, cwd => $auth_home, path => '/bin:/usr/bin', - command => "${auth_home}/on_update.sh", environment => ["HOME=${auth_home}"], - refreshonly => true, + command => "${auth_home}/on_update.sh", require => File["${auth_home}/on_update.sh"], + refreshonly => true, notify => Service[$auth_service], } diff --git a/manifests/broker.pp b/manifests/broker.pp index 3a093332f110217a9ff26eb5f313e39903219e51..ababc237d0ed289b7df4c1a114c60af29514ad96 100644 --- a/manifests/broker.pp +++ b/manifests/broker.pp @@ -1,7 +1,8 @@ # @summary -# Describe what this class do! +# Message broker for the communication module. # -# Detailed summary info if suitable +# Sets up the message broker for the communication module in the +# new exam system. # # class aes::broker { @@ -93,14 +94,26 @@ class aes::broker { source => "puppet:///modules/${module_name}/broker/cert/${server_type}_password", } - exec { 'update-broker-repo' : - command => "/opt/utils/update_repo.sh ${broker_home}/src https://oauth2:F-agHaRXCdyFy38q4c-N@gitlab.liu.se/upp-aes/communication.git ${server_type}", - environment => ["REPO_USER=${broker_user}", "REPO_GROUP=${broker_group}", "REPO_ON_UPDATE=${broker_home}/on_update.sh"], - # This command will need to run "on_update" as root in order to restart the service. - user => root, - group => root, + vcsrepo { "${broker_home}/src": + ensure => latest, + provider => git, + source => 'https://oauth2:F-agHaRXCdyFy38q4c-N@gitlab.liu.se/upp-aes/communication.git', + revision => $server_type, + owner => $broker_user, + group => $broker_group, + notify => 'compile-broker-repo', + } + + exec { 'compile-broker-repo': + user => $broker_user, + group => $broker_group, cwd => $broker_home, - require => File["${broker_home}/on_update.sh"], + path => '/bin:/usr/bin', + environment => ["HOME=${auth_home}"], + command => "${auth_home}/on_update.sh", + require => File["${auth_home}/on_update.sh"], + refreshonly => true, + notify => Service[$broker_service], } service { $broker_service :