Skip to content

Commit

Permalink
Added support for IAM profile and added exact timestamp option
Browse files Browse the repository at this point in the history
  • Loading branch information
fbrnc committed Dec 7, 2015
1 parent 5ab90e2 commit e23b8d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions systemstorage_import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ if [[ "${SYSTEMSTORAGEPATH}" =~ ^s3:// ]] ; then
SYSTEMSTORAGE_LOCAL=`mktemp -d`
trap cleanup EXIT

if [ -z "${AWSCLIPROFILE}" ] ; then echo "No awsCliProfile given"; usage 1; fi
PROFILEPARAM=""
if [ ! -z "${AWSCLIPROFILE}" ] ; then
PROFILEPARAM="--profile ${AWSCLIPROFILE}"
fi
echo "Downloading systemstorage from S3"
aws --profile ${AWSCLIPROFILE} s3 sync --delete "${SYSTEMSTORAGEPATH}" "${SYSTEMSTORAGE_LOCAL}" || { echo "Error while syncing files from S3 to local" ; exit 1; }
aws ${PROFILEPARAM} s3 sync --exact-timestamps --delete "${SYSTEMSTORAGEPATH}" "${SYSTEMSTORAGE_LOCAL}" || { echo "Error while syncing files from S3 to local" ; exit 1; }
else
SYSTEMSTORAGE_LOCAL=${SYSTEMSTORAGEPATH}
fi


if [ ! -d "${SYSTEMSTORAGE_LOCAL}" ] ; then echo "Could not find systemstorage project root $SYSTEMSTORAGE_LOCAL" ; usage 1; fi
if [ ! -d "${SYSTEMSTORAGE_LOCAL}/database" ] ; then echo "Invalid $SYSTEMSTORAGE_LOCAL (could not find database folder)" ; exit 1; fi
if [ ! -f "${SYSTEMSTORAGE_LOCAL}/database/combined_dump.sql.gz" ] ; then echo "Invalid $SYSTEMSTORAGE_LOCAL (could not find combined_dump.sql.gz)" ; exit 1; fi
Expand Down

0 comments on commit e23b8d5

Please sign in to comment.