2009-11-14 09:11:53 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# Clean up security groups for the EC2 HBase cluster
|
|
|
|
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
echo "Cluster name required!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
CLUSTER=$1
|
|
|
|
|
|
|
|
# Import variables
|
|
|
|
bin=`dirname "$0"`
|
|
|
|
bin=`cd "$bin"; pwd`
|
|
|
|
. "$bin"/hbase-ec2-env.sh
|
|
|
|
|
|
|
|
echo "Revoking security groups"
|
|
|
|
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
|
2009-11-14 09:11:53 -05:00
|
|
|
if [ $? -eq 0 ]; then
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
|
2009-11-14 09:11:53 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
|
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID
|
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
|
2009-11-14 09:11:53 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
ec2-describe-group | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
|
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
|
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
|
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
|
|
|
|
ec2-revoke $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER -u $AWS_ACCOUNT_ID
|
2009-11-14 09:11:53 -05:00
|
|
|
fi
|
|
|
|
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
|
2009-11-14 09:11:53 -05:00
|
|
|
if [ $? -eq 0 ]; then
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-delete-group $TOOL_OPTS $CLUSTER_MASTER
|
2009-11-14 09:11:53 -05:00
|
|
|
fi
|
|
|
|
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
|
2009-11-14 09:11:53 -05:00
|
|
|
if [ $? -eq 0 ]; then
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-delete-group $TOOL_OPTS $CLUSTER_ZOOKEEPER
|
2009-11-14 09:11:53 -05:00
|
|
|
fi
|
|
|
|
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
|
2009-11-14 09:11:53 -05:00
|
|
|
if [ $? -eq 0 ]; then
|
2009-11-17 03:00:24 -05:00
|
|
|
ec2-delete-group $TOOL_OPTS $CLUSTER
|
2009-11-14 09:11:53 -05:00
|
|
|
fi
|