tools: improve deploy-openstack script
Check first parameter and check for a dirty git repo before deploying
This commit is contained in:
parent
e92424b5e3
commit
4ea758a8bb
1 changed files with 14 additions and 0 deletions
|
|
@ -25,6 +25,20 @@ scriptdir=$(dirname "$0")
|
|||
config=$1
|
||||
userdata=$2
|
||||
|
||||
if [ ! -f "$config" ]; then
|
||||
echo "first parameter should be a file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$(dirname "$config")/../.git" ]; then
|
||||
if [ "$(git status --porcelain -uno | wc -l)" -gt 0 ] || [ "$(git branch --show-current)" != "main" ]; then
|
||||
read -p "Are you sure you want to deploy from git repo with non-main branch or dirty files ? " -n 1 -r
|
||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify that an openstackrc file has been sourced. This will fail when the
|
||||
# variables do not exist.
|
||||
printenv OS_PROJECT_NAME OS_USERNAME > /dev/null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue