Created
August 4, 2014 16:15
-
-
Save bloodearnest/2b90f34e6d24049b4834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wavy@shredder:~/canonical/dev/sso$ cat ~/bin/juju-sync-charm | |
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "You must provide a unit name" >&2 | |
exit 1 | |
fi | |
UNIT=$1 | |
DIR=${2:-.} | |
echo "WARNING: This will attempt to merge local changes to the charm on $UNIT into $DIR" | |
read -p "Continue? [y/N] " doit | |
if [ "${doit,,}" != "y" ] | |
then | |
exit 1 | |
fi | |
IP=$(juju stat $UNIT | grep -F public-address | head -1 | awk '{ print $2 }') | |
UNITDIR="unit-$(echo $UNIT | sed 's#/#-#')" | |
rsync -Wa --exclude revision --exclude .juju-charm -e ssh ubuntu@$IP:/var/lib/juju/agents/$UNITDIR/charm/ $DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment