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/custconfig.json.erb b/templates/mariadb/custconfig.json.erb new file mode 100644 index 0000000..2712515 --- /dev/null +++ b/templates/mariadb/custconfig.json.erb @@ -0,0 +1 @@ +<%= @custdata.to_json %> 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}