Skip to content
Snippets Groups Projects
Commit 3aa9aa2f authored by Filip Strömbäck's avatar Filip Strömbäck
Browse files

Migrated OpenDSA to use vcsrepo.

parent d98c7ae9
No related branches found
No related tags found
2 merge requests!50Fix: Puppet Defining "data_provider": "hiera" in metadata.json is deprecated....,!40Merge from devel. Commits related to RHEL9 upgrade and pdk cleanup.
Pipeline #101987 passed
......@@ -3,9 +3,6 @@
# This file is called whenever the OpenDSA repo was updated. This means we should re-check
# the requirements.txt file and restart the service.
# Note: This file is executed as root, so we drop back to the opendsa user before starting pip.
update_pip_fn=$(cat <<'EOF'
cd
python3 -m pip install --user -r OpenDSA/server/requirements.txt
......@@ -15,11 +12,3 @@ then
cd OpenDSA/server/
./main.py init_db
fi
EOF
)
# Run PIP as OpenDSA.
sudo --user opendsa --group opendsa --set-home -- bash -c "$update_pip_fn"
# Then, we can restart the service.
systemctl service restart opendsa.service
# @summary
# Describe what this class do!
# Install required LaTeX packages for PDF generation.
#
# Detailed summary info if suitable
#
......
# @summary
# Describe what this class do!
# OpenDSA server for exams.
#
# Detailed summary info if suitable
#
......@@ -30,9 +30,9 @@ class aes::opendsa {
# This file will be executed as root, which is why we don't let anyone but root examine it.
file { "${opendsa_home}/on_update.sh":
ensure => file,
owner => root,
group => root,
mode => '0700',
owner => $opendsa_user,
group => $opendsa_group,
mode => '0755',
source => "puppet:///modules/${module_name}/opendsa/on_update.sh",
}
......@@ -44,14 +44,26 @@ class aes::opendsa {
source => "puppet:///modules/${module_name}/opendsa/opendsa.service",
}
exec { 'update-repo':
command => "/opt/utils/update_repo.sh ${opendsa_home}/OpenDSA https://oauth2:taNPRZid9Hv6jJtdW_T8@gitlab.liu.se/opendsa/OpenDSA.git exam",
environment => ["REPO_USER=${opendsa_user}", "REPO_GROUP=${opendsa_group}", "REPO_ON_UPDATE=${opendsa_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 { "${opendsa_home}/src":
ensure => latest,
provider => git,
source => 'https://oauth2:taNPRZid9Hv6jJtdW_T8@gitlab.liu.se/opendsa/OpenDSA.git',
revision => 'exam',
owner => $opendsa_user,
group => $opendsa_group,
notify => Exec['update-opendsa-repo'],
}
exec { 'update-opendsa-repo':
user => $opendsa_user,
group => $opendsa_group,
cwd => $opendsa_home,
path => '/bin:/usr/bin',
environment => ["HOME=${opendsa_home}"],
command => "${opendsa_home}/on_update.sh",
require => File["${opendsa_home}/on_update.sh"],
notify => Service[$opendsa_service],
refreshonly => true
}
file { "${opendsa_home}/manage.sh":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment