From 5fbd43d5a948ac7773955a26c1d0cb0db42252d9 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 6 Sep 2016 13:59:05 +0200 Subject: git subrepo clone https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated subrepo: subdir: "files/puppet/modules/pixelated" merged: "6086b94" upstream: origin: "https://github.com/pixelated/puppet-pixelated.git" branch: "master" commit: "6086b94" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "1e79595" --- ...ate_data_from_dispatcher_to_multi_user_agent.sh | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh (limited to 'files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh') diff --git a/files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh b/files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh new file mode 100755 index 0000000..68dba6b --- /dev/null +++ b/files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# + +DISPATCHER_LEAP_FOLDER=/var/lib/pixelated/dispatcher +DESTINATION_LEAP_FOLDER=/var/lib/pixelated/.leap + +hash ls $DESTINATION_LEAP_FOLDER 2>/dev/null || mkdir -p $DESTINATION_LEAP_FOLDER +hash jq 2>/dev/null || apt-get install jq + +echo $all_users +echo 'about to copy user soledad client folders' +for user in $(ls $DISPATCHER_LEAP_FOLDER) +do + user_id=$(/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc '127.0.0.1:5984/identities/_all_docs?include_docs=true' | grep 'address":"'$user'@' | jq -r '.doc.user_id' 2> /dev/null) + echo 'User '$user', User ID' $user_id + + # if no user id + if [ -z $user_id ] || [ $user_id = 'null' ]; then + echo 'skipping...' + continue + fi + + leap_folder=$DISPATCHER_LEAP_FOLDER/$user/data/$user_id + if [ -d $leap_folder ]; then + cp -r $leap_folder $DESTINATION_LEAP_FOLDER + else + data_folder=$DISPATCHER_LEAP_FOLDER/$user/data + mkdir -p $DESTINATION_LEAP_FOLDER/$user_id + cp -r $data_folder/providers $DESTINATION_LEAP_FOLDER/$user_id + cp -r $data_folder/search_index $DESTINATION_LEAP_FOLDER/$user_id + cp -r $data_folder/soledad $DESTINATION_LEAP_FOLDER/$user_id + fi + echo 'done with user' $user +done + +echo "******* data moved ********" \ No newline at end of file -- cgit v1.2.3