ArielGlenn has submitted this change and it was merged.
Change subject: deployment script: better error handling, make correct remote
dirs
......................................................................
deployment script: better error handling, make correct remote dirs
Change-Id: I59474ed0bea6303a002a9eb0e207b1954d4b6811
---
M deployment/copy-dir.sh
1 file changed, 14 insertions(+), 5 deletions(-)
Approvals:
ArielGlenn: Verified; Looks good to me, approved
diff --git a/deployment/copy-dir.sh b/deployment/copy-dir.sh
index dff87f2..7874b10 100644
--- a/deployment/copy-dir.sh
+++ b/deployment/copy-dir.sh
@@ -32,10 +32,10 @@
fi
while [ $# -gt 0 ]; do
- if [ $1 == "--deploydir" ]; then
+ if [ "$1" == "--deploydir" ]; then
deploydir="$2"
shift; shift
- elif [ $1 == "--hosts" ]; then
+ elif [ "$1" == "--hosts" ]; then
hostnames="$2"
shift; shift
else
@@ -107,8 +107,9 @@
# make sure the directory exists before we try to copy it to the remote hosts
if [ ! -d "$basedir/deploy/$deploydir" ]; then
- echo "Directory $basedir/deploy/$deploydir does not exist or it's not a
directory, exiting"
- exit 1
+ echo "Directory $basedir/deploy/$deploydir does not exist or it's not a
directory,"
+ echo "did you forget to specify --deploydir?"
+ usage
fi
exitcode=0
@@ -116,7 +117,7 @@
echo "Copying..."
for h in $hostnames; do
- ssh root@$h "mkdir -p $basedir/deploy/"
+ ssh root@$h "mkdir -p $deploymentbase"
scp -rp -q -o ConnectTimeOut=20 $basedir/deploy/$deploydir
root@$h:$deploymentbase/
if [ $? -ne 0 ]; then
# serious whine
@@ -124,6 +125,10 @@
exitcode=1
fi
done
+
+if [ "$exitcode" == "1" ]; then
+ exit 1
+fi
# why don't we do this on the source host? because all kinds of people have
access there, and we don't want them to
# see passwords or whatever that might be in config files.
@@ -137,5 +142,9 @@
fi
done
+if [ "$exitcode" == "1" ]; then
+ exit 1
+fi
+
echo "Done!"
--
To view, visit https://gerrit.wikimedia.org/r/72708
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I59474ed0bea6303a002a9eb0e207b1954d4b6811
Gerrit-PatchSet: 1
Gerrit-Project: operations/dumps
Gerrit-Branch: ariel
Gerrit-Owner: ArielGlenn <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits