Skip to content

Commit 3d57ef8

Browse files
committed
server.sh: Make -k <keypair> optional
This will allow us to remove keypair generation from the periodic, as it's no longer required.
1 parent 8d182f0 commit 3d57ef8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server.sh

Lines changed: 5 additions & 3 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

0 commit comments

Comments
 (0)