forked from hashicorp/vault
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix autopilot scenario failures (hashicorp#21025)
* Fix autopilot scenario failures Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com> Signed-off-by: Mike Baum <mike.baum@hashicorp.com> * use bash instead of sh in create logs dir shell script * ensure to only enable the file audit device in the upgrade cluster of the autopilot scenario if the variable is enabled --------- Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com> Signed-off-by: Mike Baum <mike.baum@hashicorp.com> Co-authored-by: Mike Baum <mike.baum@hashicorp.com>
- Loading branch information
Jaymala
and
Mike Baum
authored
Jun 6, 2023
1 parent
45b9dff
commit 8512858
Showing
3 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
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
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
26 changes: 24 additions & 2 deletions
26
enos/modules/vault_cluster/scripts/create_audit_log_dir.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,30 @@ | ||
#!/bin/env sh | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
LOG_DIR=$(dirname "$LOG_FILE_PATH") | ||
|
||
function retry { | ||
local retries=$1 | ||
shift | ||
local count=0 | ||
|
||
until "$@"; do | ||
exit=$? | ||
wait=10 | ||
count=$((count + 1)) | ||
|
||
if [ "$count" -lt "$retries" ]; then | ||
sleep "$wait" | ||
else | ||
return "$exit" | ||
fi | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
retry 7 id -a "$SERVICE_USER" | ||
|
||
sudo mkdir -p "$LOG_DIR" | ||
sudo chown "$SERVICE_USER":"$SERVICE_USER" "$LOG_DIR" | ||
sudo chown -R "$SERVICE_USER":"$SERVICE_USER" "$LOG_DIR" |