summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2013-09-02 13:25:36 +0200
committervarac <varacanero@zeromail.org>2013-09-02 13:25:36 +0200
commit57c384dcc7b59d307d89b0f6afa52b8ad8b47a5f (patch)
tree041be771e7299731b040ccaf179b90d825f58ae6
parenta68520445d4ee2cf5072f261109d1fd8c31983c2 (diff)
make flavor and secgroup optional
-rwxr-xr-xrevert_instance_from_snapshot.sh25
1 files 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 <instance>
-s <snapshot>
-k <keyname> add sshkey
+
+optional:
+ -f <flavor> defaults to "$flavor"
+ -g <secgroup> 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;;