File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,16 @@ print_help() {
23
23
echo -e ' Spin a server on OpenStack'
24
24
echo
25
25
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"
27
27
echo
28
28
echo -e ' Required parameters:'
29
29
echo -e ' \t-f\tFlavor of the Compute instance.'
30
30
echo -e ' \t-i\tImage of the Compute instance.'
31
31
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.'
33
32
echo -e ' \tNAME: name to give to the OpenStack resources.'
34
33
echo
35
34
echo -e ' Optional parameters:'
35
+ echo -e ' \t-k\tName or ID of the SSH public key to add to the server.'
36
36
echo -e ' \t-d\tRun the script in debug mode'
37
37
echo -e ' \t-p\tDo not clean up the server after creation'
38
38
echo -e ' \t\t(will print a cleanup script instead of executing it).'
@@ -215,8 +215,10 @@ server_create_args=(
215
215
--flavor " $server_flavor "
216
216
--nic " port-id=$port_id "
217
217
--security-group " $sg_id "
218
- --key-name " $key_name "
219
218
)
219
+ if [ -n " $key_name " ]; then
220
+ server_create_args+=(--key-name " $key_name " )
221
+ fi
220
222
if [ " $liveness " == ' yes' ]; then
221
223
server_create_args+=(--user-data " ${script_dir} /connectivity-test-cloud-init.yaml" )
222
224
fi
You can’t perform that action at this time.
0 commit comments