Create user: skip zip creation run if there are no PEM files
Avoid "file not found" zip file creation and remove if there are no PEM files created, eg if we have a pre defined pub file
This commit is contained in:
@@ -421,6 +421,8 @@ done;
|
||||
if [ ${INFO} -eq 1 ]; then
|
||||
exit;
|
||||
fi;
|
||||
# check if there are any files in the SSH_KEYGEN_FOLDER, else skip zip file creation and file move
|
||||
if (shopt -s nullglob dotglob; f=("${SSH_KEYGEN_FOLDER}"*".pem"*); ((${#f[@]}))); then
|
||||
# zip everything and remove data in ssh key folder, delete output file with passwords
|
||||
if [ ${TEST} -eq 0 ]; then
|
||||
zip -r \
|
||||
@@ -450,5 +452,6 @@ else
|
||||
echo "$> rm ${ROOT_FOLDER}${output_file}";
|
||||
echo "$> rm ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}*";
|
||||
fi;
|
||||
fi;
|
||||
|
||||
# __END__
|
||||
|
||||
Reference in New Issue
Block a user