aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/availability/ha_tools/nova/remove_server_from_secgroup.bash
blob: 61d0a2b494b0aced370a3c26b8ec9cabedb241a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

##############################################################################
# Copyright (c) 2018 Intracom Telecom and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

# remove server from existing security group
# parameters: $1 - server name, $2 - security group name

set -e

if [ $OS_INSECURE ] && [ "$(echo $OS_INSECURE | tr '[:upper:]' '[:lower:]')" = "true" ]; then
    SECURE="--insecure"
else
    SECURE=""
fi

SECGROUPNAME="$(openstack ${SECURE} security group list -f value -c Name | grep $2)"

openstack ${SECURE} server remove security group $1 ${SECGROUPNAME}