Skip to content

Commit 302d807

Browse files
fix shfmt issues:
I'm exactly sure what shfmt wanted but ran shfmt -w to get the updated formatting. Signed-off-by: Jacob Weinstock <[email protected]>
1 parent 300c4a0 commit 302d807

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

capt/scripts/generate_state.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,25 +139,25 @@ function main() {
139139
os_version=$(echo "$os_version" | tr -d '.')
140140
yq e -i '.os.version = "'$os_version'"' "$state_file"
141141

142-
# if the sshKey is not set, generate a default one
143-
ssh_key=$(yq eval '.os.sshKey' "$config_file")
144-
if [[ -z $ssh_key ]]; then
145-
rm -rf "$output_dir"/capt-ssh-key* >>"$output_dir"/error.log 2>&1
146-
ssh-keygen -t ed25519 -f "$output_dir"/capt-ssh-key -N "" -C "capt-playground" >>"$output_dir"/error.log 2>&1
147-
if [[ $? -ne 0 ]]; then
148-
echo "Error generating SSH key. Check error.log for details." >>"$output_dir"/error.log 2>&1
149-
exit 1
150-
fi
151-
ssh_key=$(cat "$output_dir/capt-ssh-key.pub"| tr -d '\n')
152-
if [[ -z $ssh_key ]]; then
153-
echo "Error reading SSH key from $output_dir/capt-ssh-key.pub" >>"$output_dir"/error.log 2>&1
154-
exit 1
155-
fi
156-
yq e -i ".os.sshKey = \"$ssh_key\"" "$state_file"
157-
# populate the config file with the generated SSH key
158-
# so that we don't re-generate it every time
159-
yq e -i ".os.sshKey = \"$ssh_key\"" "$config_file"
160-
fi
142+
# if the sshKey is not set, generate a default one
143+
ssh_key=$(yq eval '.os.sshKey' "$config_file")
144+
if [[ -z $ssh_key ]]; then
145+
rm -rf "$output_dir"/capt-ssh-key* >>"$output_dir"/error.log 2>&1
146+
ssh-keygen -t ed25519 -f "$output_dir"/capt-ssh-key -N "" -C "capt-playground" >>"$output_dir"/error.log 2>&1
147+
if [[ $? -ne 0 ]]; then
148+
echo "Error generating SSH key. Check error.log for details." >>"$output_dir"/error.log 2>&1
149+
exit 1
150+
fi
151+
ssh_key=$(cat "$output_dir/capt-ssh-key.pub" | tr -d '\n')
152+
if [[ -z $ssh_key ]]; then
153+
echo "Error reading SSH key from $output_dir/capt-ssh-key.pub" >>"$output_dir"/error.log 2>&1
154+
exit 1
155+
fi
156+
yq e -i ".os.sshKey = \"$ssh_key\"" "$state_file"
157+
# populate the config file with the generated SSH key
158+
# so that we don't re-generate it every time
159+
yq e -i ".os.sshKey = \"$ssh_key\"" "$config_file"
160+
fi
161161
}
162162

163163
main "$@"

0 commit comments

Comments
 (0)