@@ -139,25 +139,25 @@ function main() {
139
139
os_version=$( echo " $os_version " | tr -d ' .' )
140
140
yq e -i ' .os.version = "' $os_version ' "' " $state_file "
141
141
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
161
161
}
162
162
163
163
main " $@ "
0 commit comments