Skip to content

Instantly share code, notes, and snippets.

@bloodearnest
Created August 4, 2014 16:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloodearnest/2b90f34e6d24049b4834 to your computer and use it in GitHub Desktop.
Save bloodearnest/2b90f34e6d24049b4834 to your computer and use it in GitHub Desktop.
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