8b749d55d00445992c65433f2029caf0789bc4c6
dschmelt
  Tue Dec 3 10:13:13 2019 -0800
Adding a few scripts to tracked Dirs #24290

diff --git src/utils/qa/hubPublicUrlChanger src/utils/qa/hubPublicUrlChanger
new file mode 100755
index 0000000..67bf2a8
--- /dev/null
+++ src/utils/qa/hubPublicUrlChanger
@@ -0,0 +1,116 @@
+# bin/bash
+# hubUrlChanger 
+# Daniel Schmelter 11/1/19
+# This script is used when a publicHub contributor asks to swap their hubUrl.
+# We need to change the hubStatus entry as well to make sure cartPointers go to the newUrl
+
+echo -e "\nCaution, this script will update hubPublic and hubStatus on Dev, Beta, and RR"
+echo -e "It is to be used when you want to change a hubUrl entry in hubPublic\n"
+
+read -p 'Enter the old hubPublic shortLabel: ' shLabel
+read -p 'Enter the new URL: ' newUrl
+
+#DEV
+read -p "Save a session with the hub connected on Dev, enter Url here: " devSesh
+echo "Get the hubId from a cartDump: https://hgwdev.gi.ucsc.edu/cgi-bin/cartDump"
+read -p 'Enter the old hubStatus ID: ' devId
+
+echo "Checking hubStatus and hubPublic before update"
+hgsql -e "select * from hubStatus where id='$devId'\G" hgcentraltest
+hgsql -e "select * from hubPublic where shortLabel='$shLabel'\G" hgcentraltest
+while true
+do
+    read -r -p 'Continue? Y or y accepted:  ' choiceDev
+    case "$choiceDev" in
+      y|Y) break ;;
+      *) echo 'Response not valid';;
+    esac
+done
+
+echo "Delete hubStatus of newUrl"
+hgsql  -e "select * from hubStatus where hubUrl='$newUrl'\G" hgcentraltest
+sleep 3
+hgsql  -e "delete from hubStatus where hubUrl='$newUrl';" hgcentraltest
+hgsql  -e "select * from hubStatus where hubUrl='$newUrl'\G" hgcentraltest
+
+echo "Update and check hubStatus and hubPublic hubUrl"
+hgsql  -e "update hubStatus set hubUrl='$newUrl' where id = '$id';" hgcentraltest
+hgsql  -e "select * from hubStatus where id='$id'\G" hgcentraltest
+sleep 3
+hgsql  -e "update hubPublic set hubUrl='$newUrl' where shortLabel='$shLabel';" hgcentraltest
+hgsql  -e "select * from hubPublic where shortLabel='$shLabel'\G" hgcentraltest
+sleep 3
+
+echo "Check dev session functionality: "
+echo $devSesh
+
+#BETA
+read -p "Save a session with the hub connected on Beta, enter Url here: " betaSesh
+echo "Get the hubId from a cartDump: https://hgwbeta.soe.ucsc.edu/cgi-bin/cartDump"
+read -p 'Enter the old hubStatus ID: ' betaId
+
+echo "Checking hubStatus and hubPublic before update"
+hgsql -e "select * from hubStatus where id='$betaId'\G" hgcentralbeta
+hgsql -e "select * from hubPublic where shortLabel='$shLabel'\G" hgcentralbeta
+while true
+do
+    read -r -p 'Continue? Y or y accepted:  ' choiceBeta
+    case "$choiceBeta" in
+      y|Y) break ;;
+      *) echo 'Response not valid';;
+    esac
+done
+
+echo "Delete hubStatus of newUrl"
+hgsql -h hgwbeta -e "select * from hubStatus where hubUrl='$newUrl'\G" hgcentralbeta
+sleep 3
+hgsql -h hgwbeta -e "delete from hubStatus where hubUrl='$newUrl';" hgcentralbeta
+hgsql -h hgwbeta -e "select * from hubStatus where hubUrl='$newUrl'\G" hgcentralbeta
+
+echo "Update and check hubStatus and hubPublic hubUrl"
+hgsql -h hgwbeta -e "update hubStatus set hubUrl='$newUrl' where id = '$betaId';" hgcentralbeta
+hgsql -h hgwbeta -e "select * from hubStatus where id='$betaId'\G" hgcentralbeta
+sleep 3
+hgsql -h hgwbeta -e "update hubPublic set hubUrl='$newUrl' where shortLabel='$shLabel';" hgcentralbeta
+hgsql -h hgwbeta -e "select * from hubPublic where shortLabel='$shLabel'\G" hgcentralbeta
+sleep 3
+
+echo "Check Beta session functionality:"
+echo $betaSesh
+
+#RR
+
+read -p "Save a session with the hub connected on Dev, enter Url here: " rrSesh
+echo "Get the hubId from a cartDump: http://genome.ucsc.edu/cgi-bin/cartDump"
+read -p 'Enter the old hubStatus ID: ' rrId
+
+echo "Checking hubStatus and hubPublic before update"
+hgsql -e "select * from hubStatus where id='$rrId'\G" hgcentral
+hgsql -e "select * from hubPublic where shortLabel='$shLabel'\G" hgcentral
+while true
+do
+    read -r -p 'Continue? Y or y accepted:  ' choiceRr
+    case "$choiceRr" in
+      y|Y) break ;;
+      *) echo 'Response not valid';;
+    esac
+done
+
+echo "Delete hubStatus of newUrl"
+hgsql -h genome-centdb -e "select * from hubStatus where hubUrl='$newUrl'\G" hgcentral
+sleep 5
+hgsql -h genome-centdb -e "delete from hubStatus where hubUrl='$newUrl';" hgcentral
+hgsql -h genome-centdb -e "select * from hubStatus where hubUrl='$newUrl'\G" hgcentral
+
+echo "Update and check hubStatus and hubPublic hubUrl"
+hgsql -h genome-centdb -e "update hubStatus set hubUrl='$newUrl' where id = '$rrId';" hgcentral
+hgsql -h genome-centdb -e "select * from hubStatus where id='$rrId'\G" hgcentral
+sleep 5
+hgsql -h genome-centdb -e "update hubPublic set hubUrl='$newUrl' where shortLabel='$shLabel';" hgcentral
+hgsql -h genome-centdb -e "select * from hubPublic where shortLabel='$shLabel'\G" hgcentral
+sleep 3
+
+echo "Check RR session functionality: "
+echo $rrSesh
+
+echo "You are DONE!"