39
DEFAULT_RABBIT_PASSWORD="guest"
38
# Determinate is the given option present in the INI file
39
# ini_has_option config-file section option
40
function ini_has_option() {
45
line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
49
# Set an option in an INI file
50
# iniset config-file section option value
56
if ! grep -q "^\[$section\]" "$file"; then
57
# Add section at the end
58
echo -e "\n[$section]" >>"$file"
60
if ! ini_has_option "$file" "$section" "$option"; then
62
sed -i -e "/^\[$section\]/ a\\
67
sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" "$file"
71
basic_configuration() {
41
73
if echo $conf_path | grep ".conf$" >/dev/null 2>&1
75
iniset $target DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/random`
76
iniset $target DEFAULT db_backend heat.db.sqlalchemy.api
77
iniset $target DEFAULT sql_connection "mysql://heat:heat@localhost/heat"
80
iniset $target DEFAULT heat_metadata_server_url "http://${BRIDGE_IP}:8000/"
81
iniset $target DEFAULT heat_waitcondition_server_url "http://${BRIDGE_IP}:8000/v1/waitcondition/"
82
iniset $target DEFAULT heat_watch_server_url "http://${BRIDGE_IP}:8003/"
45
86
echo "rabbitmq detected, configuring $conf_path for rabbit" >&2
46
sed -i "/^rpc_backend\b/ s/impl_qpid/impl_kombu/" $conf_path
47
sed -i "/^rpc_backend/a rabbit_password=$DEFAULT_RABBIT_PASSWORD" $conf_path
87
iniset $conf_path DEFAULT rpc_backend heat.openstack.common.rpc.impl_kombu
88
iniset $conf_path DEFAULT rabbit_password guest
90
echo "qpid detected, configuring $conf_path for qpid" >&2
91
iniset $conf_path DEFAULT rpc_backend heat.openstack.common.rpc.impl_qpid
56
100
for fn in $(ls $dir); do
103
if [ $fn = 'heat.conf.sample' ]; then
104
target=$prefix/$dir/heat.conf
58
106
if [ -d $f ]; then
59
[ -d $prefix/$f ] || install -d $prefix/$f
107
[ -d $target ] || install -d $target
60
108
install_dir $f $prefix
61
elif [ -f $prefix/$f ]; then
62
echo "NOT replacing existing config file $prefix/$f" >&2
109
elif [ -f $target ]; then
110
echo "NOT replacing existing config file $target" >&2
65
113
echo "Installing $fn in $prefix/$dir" >&2
66
install -m 664 $f $prefix/$dir
67
if [ $fn = 'heat-engine.conf' ]; then
68
sed -i "s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e '/1 "%02x"' /dev/random`/" $prefix/$f
114
install -m 664 $f $target
115
if [ $fn = 'heat.conf.sample' ]; then
116
basic_configuration $target
70
sed_if_rabbit $prefix/$f
75
122
install_dir etc $CONF_PREFIX
77
./setup.py install >/dev/null
124
python setup.py install >/dev/null
78
125
rm -rf build heat.egg-info