Alert on missing secrets, re-add . → _ STACK_NAME

This commit is contained in:
3wc 2021-01-09 15:07:39 +02:00
parent 1c7a51bce1
commit 8a08de51e4
2 changed files with 13 additions and 3 deletions

View File

@ -17,7 +17,7 @@
- Add built-in documentation using `abra help <subcommand>...`, see ([#50](https://git.autonomic.zone/coop-cloud/abra/issues/50))
- `version` subcommand ([e6b24fe](https://git.autonomic.zone/coop-cloud/abra/commit/e6b24fe))
- Use `# length=x` comments to generate passwords with `pwgen` and drop `KEY`/`PASSWORD` logic ([#68](https://git.autonomic.zone/coop-cloud/abra/issues/68))
- Global `--skip-update` / `--skip-check` options to make things quicker,
- Global `--skip-update|-U` / `--skip-check|-C` options to make things quicker,
[37e8b00](https://git.autonomic.zone/coop-cloud/abra/commit/37e8b00)
- `app backup` and `app restore` commands; requires per-app definition -- see
[#70](https://git.autonomic.zone/coop-cloud/abra/issues/70)

14
abra
View File

@ -425,7 +425,7 @@ load_instance() {
fi
IFS='/' read -r -a PARTS <<< "$ENV_FILE"
SERVER="${PARTS[-2]}"
export STACK_NAME="$APP"
export STACK_NAME="${APP//./_}"
}
load_instance_env() {
@ -507,6 +507,10 @@ stack_logs (){
auto_gen_secrets (){
get_app_secrets
if [ "${#PASSWORDS[@]}" -eq 0 ]; then
error "No secrets found in $ENV_FILE"
fi
for PASSWORD in "${PASSWORDS[@]}"; do
parse_secret "$PASSWORD"
done
@ -680,7 +684,10 @@ sub_app_new (){
get_app_secrets
if [ "${#PASSWORDS[@]}" -gt 0 ] && [ "$abra___secrets" == "true" ]; then
if [ "$abra___secrets" == "true" ]; then
if [ "${#PASSWORDS[@]}" -eq 0 ]; then
warning "--secrets provided but no secrets found"
fi
auto_gen_secrets
fi
@ -1019,6 +1026,7 @@ sub_app_secret_generate(){
abra___all="false"
auto_gen_secrets
return
fi
if [[ -n "$LENGTH" ]]; then
@ -1029,6 +1037,8 @@ sub_app_secret_generate(){
PWGEN="${abra__cmd_:-pwqgen}"
fi
echo "SECRET: $SECRET, VERSION $VERSION, PW $PW, ALL $abra___all"
if [ -z "$SECRET" ] || [ -z "$VERSION" ] && [ "$abra___all" == "false" ]; then
error "Required arguments missing"
fi