From 15bda3e4630618135b26bd5a41f48e8c2fb0112b Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 11 Jan 2013 15:07:53 -0600 Subject: [PATCH] Handle existing security group rules in volume exercise Change-Id: I0aa3bc0c6179f92a12c1e9bbace61597778ffa1f --- exercises/volumes.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercises/volumes.sh b/exercises/volumes.sh index 5c5e0e448a..45b8645bbb 100755 --- a/exercises/volumes.sh +++ b/exercises/volumes.sh @@ -86,8 +86,12 @@ if ! nova secgroup-list | grep -q $SECGROUP; then fi # Configure Security Group Rules -nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0 -nova secgroup-add-rule $SECGROUP tcp 22 22 0.0.0.0/0 +if ! nova secgroup-list-rules $SECGROUP | grep -q icmp; then + nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0 +fi +if ! nova secgroup-list-rules $SECGROUP | grep -q " tcp .* 22 "; then + nova secgroup-add-rule $SECGROUP tcp 22 22 0.0.0.0/0 +fi # determinine instance type # -------------------------