From 57c384dcc7b59d307d89b0f6afa52b8ad8b47a5f Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 2 Sep 2013 13:25:36 +0200 Subject: make flavor and secgroup optional --- revert_instance_from_snapshot.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/revert_instance_from_snapshot.sh b/revert_instance_from_snapshot.sh index 705d055..4031cbf 100755 --- a/revert_instance_from_snapshot.sh +++ b/revert_instance_from_snapshot.sh @@ -1,12 +1,14 @@ #!/bin/bash # # following prerequisites are needed -# - all keys must be present to current user (use add_keys script to import) +# * all ssh-keys specified with the -k option must +# be present to current user (use add_keys script to import) -# Todo: How do we add more keys with the nova cli ? +# Todo: How can we add more than one sshkey with the nova cli ? # 2 cpus, 10gb disk, 1024 ram -flavor='testing' + +flavor='Medium' secgroup='Bitmask' usage() @@ -16,16 +18,25 @@ usage: $0 options This script reverts an openstack instance to it's snapshot. -OPTIONS: - -h Show this message +mandatory: -i -s -k add sshkey + +optional: + -f defaults to "$flavor" + -g defaults to "$secgroup" + -h Show this message -v verbose mode + +example: + + ./revert_instance_from_snapshot.sh -i resettest.testing.bitmask.net -s resettest-firstboot -k varac + EOF } -set -- $(getopt hi:s:k:v "$@") +set -- $(getopt hi:s:k:f:g:v "$@") while [ $# -gt 0 ] do case "$1" in @@ -33,6 +44,8 @@ do (-i) instance="$2"; shift;; (-s) snapshot="$2"; shift;; (-k) key="$2"; shift;; + (-f) flavor="$2"; shift;; + (-g) secgroup="$2"; shift;; (--) shift; break;; (-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;; (*) break;; -- cgit v1.2.3