Skip to content

Commit fda65b8

Browse files
author
Dean Troyer
committed
New build_ci_config.sh
1 parent 1a5a65f commit fda65b8

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

tools/build_ci_config.sh

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/usr/bin/env bash
2+
#
3+
# build_ci_config.sh - Build a config.ini for openstack-integration-tests
4+
# (https://github.com/openstack/openstack-integration-tests)
5+
6+
function usage {
7+
echo "$0 - Build config.ini for openstack-integration-tests"
8+
echo ""
9+
echo "Usage: $0 configfile"
10+
exit 1
11+
}
12+
13+
if [ ! "$#" -eq "1" ]; then
14+
usage
15+
fi
16+
17+
CONFIG_FILE=$1
18+
19+
# Clean up any resources that may be in use
20+
cleanup() {
21+
set +o errexit
22+
23+
# Mop up temporary files
24+
if [ -n "$CONFIG_FILE_TMP" -a -e "$CONFIG_FILE_TMP" ]; then
25+
rm -f $CONFIG_FILE_TMP
26+
fi
27+
28+
# Kill ourselves to signal any calling process
29+
trap 2; kill -2 $$
30+
}
31+
32+
trap cleanup SIGHUP SIGINT SIGTERM
33+
34+
# Keep track of the current directory
35+
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
36+
TOP_DIR=`cd $TOOLS_DIR/..; pwd`
37+
38+
# Abort if localrc is not set
39+
if [ ! -e $TOP_DIR/localrc ]; then
40+
echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding."
41+
echo "See stack.sh for required passwords."
42+
exit 1
43+
fi
44+
45+
# Source params
46+
source ./stackrc
47+
48+
# Where Openstack code lives
49+
DEST=${DEST:-/opt/stack}
50+
51+
# Process network configuration vars
52+
GUEST_NETWORK=${GUEST_NETWORK:-1}
53+
GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
54+
55+
GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
56+
GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
57+
GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
58+
GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
59+
GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
60+
GUEST_RAM=${GUEST_RAM:-1524288}
61+
GUEST_CORES=${GUEST_CORES:-1}
62+
63+
# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP``
64+
HOST_IP=${HOST_IP:-$GUEST_IP}
65+
# Use the first IP if HOST_IP still is not set
66+
if [ ! -n "$HOST_IP" ]; then
67+
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
68+
fi
69+
70+
RABBIT_HOST=${RABBIT_HOST:-localhost}
71+
72+
# Glance connection info. Note the port must be specified.
73+
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
74+
set `echo $GLANCE_HOSTPORT | tr ':' ' '`
75+
GLANCE_HOST=$1
76+
GLANCE_PORT=$2
77+
78+
CONFIG_FILE_TMP=$(mktemp $CONFIG_FILE.XXXXXX)
79+
cat >$CONFIG_FILE_TMP <<EOF
80+
[environment]
81+
aki_location = include/sample_vm/natty-server-cloudimg-amd64-vmlinuz-virtual
82+
#ari_location = include/sample_vm/natty-server-cloudimg-amd64-loader
83+
ami_location = include/sample_vm/natty-server-cloudimg-amd64.img
84+
85+
[glance]
86+
host = $GLANCE_HOST
87+
apiver = v1.0
88+
port = $GLANCE_PORT
89+
image_id = 1
90+
91+
[keystone]
92+
service_host = $HOST_IP
93+
service_port = 5000
94+
apiver = v1.1
95+
user = admin
96+
password = $ADMIN_PASSWORD
97+
tenant_id = 1
98+
99+
[nova]
100+
host = $HOST_IP
101+
port = 8774
102+
apiver = v1.1
103+
project = admin
104+
user = admin
105+
key = $SERVICE_TOKEN
106+
ssh_timeout = 300
107+
build_timeout = 300
108+
flavor_ref = 1
109+
flavor_ref_alt = 2
110+
111+
[rabbitmq]
112+
host = $RABBIT_HOST
113+
user = guest
114+
password = $RABBIT_PASSWORD
115+
116+
[swift]
117+
auth_host = $HOST_IP
118+
auth_port = 443
119+
auth_prefix = /auth/
120+
auth_ssl = yes
121+
account = system
122+
username = root
123+
password = password
124+
125+
EOF
126+
mv $CONFIG_FILE_TMP $CONFIG_FILE

0 commit comments

Comments
 (0)