Skip to content

Commit 10287c5

Browse files
Merge pull request #200 from shiftstack/server-sh-cleanup
Make -k <keypair> optional
2 parents 8d182f0 + 9ff5a8c commit 10287c5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

server.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ print_help() {
2323
echo -e 'Spin a server on OpenStack'
2424
echo
2525
echo -e 'Usage:'
26-
echo -e "\t${0} [-p] -f <flavor> -i <image> -e <external network> -k <key> NAME"
26+
echo -e "\t${0} [-p] [-k <key>] -f <flavor> -i <image> -e <external network> NAME"
2727
echo
2828
echo -e 'Required parameters:'
2929
echo -e '\t-f\tFlavor of the Compute instance.'
3030
echo -e '\t-i\tImage of the Compute instance.'
3131
echo -e '\t-e\tName or ID of the public network where to create the floating IP.'
32-
echo -e '\t-k\tName or ID of the SSH public key to add to the server.'
3332
echo -e '\tNAME: name to give to the OpenStack resources.'
3433
echo
3534
echo -e 'Optional parameters:'
35+
echo -e '\t-k\tName or ID of the SSH public key to add to the server.'
3636
echo -e '\t-d\tRun the script in debug mode'
3737
echo -e '\t-p\tDo not clean up the server after creation'
3838
echo -e '\t\t(will print a cleanup script instead of executing it).'
@@ -215,8 +215,10 @@ server_create_args=(
215215
--flavor "$server_flavor"
216216
--nic "port-id=$port_id"
217217
--security-group "$sg_id"
218-
--key-name "$key_name"
219218
)
219+
if [ -n "$key_name" ]; then
220+
server_create_args+=(--key-name "$key_name")
221+
fi
220222
if [ "$liveness" == 'yes' ]; then
221223
server_create_args+=(--user-data "${script_dir}/connectivity-test-cloud-init.yaml")
222224
fi
@@ -263,7 +265,7 @@ for driver in "${!drivers[@]}"; do
263265
# propagated to the network hardware yet, which curl cannot.
264266
start=$(date +%s)
265267
backoff=1
266-
while ! curl --fail-with-body http://"$fip_address"/; do
268+
while ! curl --fail-with-body --no-progress-meter http://"$fip_address"/; do
267269
# This normally succeeds immediately, but we allow it up to
268270
# 300 seconds.
269271
if [ $(( $(date +%s)-start )) -gt 300 ]; then

0 commit comments

Comments
 (0)