From 28b6584a6cf23de61b9eaee89e7a50d16ee9db8d Mon Sep 17 00:00:00 2001 From: Magnus Andersson Date: Mon, 9 Sep 2024 16:18:00 +0200 Subject: [PATCH] Dump customer datastructure for statistics logic to be transferred to script1. --- manifests/multinode_db.pp | 7 +++++++ templates/mariadb/genuserdeplists.sh.erb | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/manifests/multinode_db.pp b/manifests/multinode_db.pp index 73acbb1..8ec056e 100644 --- a/manifests/multinode_db.pp +++ b/manifests/multinode_db.pp @@ -55,6 +55,13 @@ class sunetdrive::multinode_db(){ group => 'root', mode => '0700', } + file {'/opt/mariadb/statistics/custdata.json': + ensure => file, + content => template('sunetdrive/mariadb/custconfig.json.erb'), + owner => 'root', + group => 'root', + mode => '0600', + } sunet::scriptherder::cronjob { 'genuserdeplists': cmd => '/root/tasks/genusersondepartmentlists.sh', hour => '2', diff --git a/templates/mariadb/genuserdeplists.sh.erb b/templates/mariadb/genuserdeplists.sh.erb index a02d348..78f4c90 100644 --- a/templates/mariadb/genuserdeplists.sh.erb +++ b/templates/mariadb/genuserdeplists.sh.erb @@ -2,6 +2,7 @@ <% basedir="statistics:drive-server-coms" -%> <% cupath="/opt/mariadb/statistics/users/" -%> +<% custdata="/opt/mariadb/statistics/custdata.json" -%> status=0 <% @custdata.each do |cust,data| -%> @@ -23,4 +24,9 @@ fi <% end -%> <% end -%> +if [[ -f <%= custdata %> ]] +then + timeout 30s rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies <%= custdata %> <%= basedir%>/ +fi + exit ${status}