Skip to content

Commit 1c19dcb

Browse files
Merge pull request #216 from jacobweinstock/fix-ssh-key-gen
Regenerate .state file when os.sshKey is empty
2 parents 302f0f8 + ef508ea commit 1c19dcb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

capt/Taskfile.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ tasks:
8888
- .state
8989
cmds:
9090
- ./scripts/generate_state.sh config.yaml .state
91+
status:
92+
- if [[ -n "$(yq '.os.sshKey' {{.STATE_FILE_FQ_PATH}})" ]]; then true; else false; fi
9193

9294
next-steps:
9395
silent: true

capt/scripts/generate_state.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ function main() {
143143
# if the sshKey is not set, generate a default one
144144
ssh_key=$(yq eval '.os.sshKey' "$config_file")
145145
if [[ -z $ssh_key ]]; then
146+
mkdir -p "$output_dir"
146147
rm -rf "$output_dir"/capt-ssh-key* >>"$output_dir"/error.log 2>&1
147148
ssh-keygen -t ed25519 -f "$output_dir"/capt-ssh-key -N "" -C "capt-playground" >>"$output_dir"/error.log 2>&1
148149
if [[ $? -ne 0 ]]; then

0 commit comments

Comments
 (0)