~ubuntu-branches/ubuntu/trusty/heat/trusty

« back to all changes in this revision

Viewing changes to install.sh

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-09-08 21:51:19 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130908215119-r939tu4aumqgdrkx
Tags: 2013.2~b3-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/control: Add python-netaddr as build-dep.
* debian/heat-common.install: Remove heat-boto and associated man-page
* debian/heat-common.install: Remove heat-cfn and associated man-page
* debian/heat-common.install: Remove heat-watch and associated man-page
* debian/patches/fix-sqlalchemy-0.8.patch: Dropped

[ Adam Gandelman ]
* debian/patches/default-kombu.patch: Dropped.
* debian/patches/default-sqlite.patch: Refreshed.
* debian/*.install, rules: Install heat.conf.sample as common
  config file in heat-common. Drop other per-package configs, they
  are no longer used.
* debian/rules: Clean pbr .egg from build dir if it exists.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    return 1
36
36
}
37
37
 
38
 
sed_if_rabbit() {
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() {
 
41
    local file=$1
 
42
    local section=$2
 
43
    local option=$3
 
44
    local line
 
45
    line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
 
46
    [ -n "$line" ]
 
47
}
 
48
 
 
49
# Set an option in an INI file
 
50
# iniset config-file section option value
 
51
function iniset() {
 
52
    local file=$1
 
53
    local section=$2
 
54
    local option=$3
 
55
    local value=$4
 
56
    if ! grep -q "^\[$section\]" "$file"; then
 
57
        # Add section at the end
 
58
        echo -e "\n[$section]" >>"$file"
 
59
    fi
 
60
    if ! ini_has_option "$file" "$section" "$option"; then
 
61
        # Add it
 
62
        sed -i -e "/^\[$section\]/ a\\
 
63
$option = $value
 
64
" "$file"
 
65
    else
 
66
        # Replace it
 
67
        sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" "$file"
 
68
    fi
 
69
}
 
70
 
 
71
basic_configuration() {
40
72
    conf_path=$1
41
73
    if echo $conf_path | grep ".conf$" >/dev/null 2>&1
42
74
    then
43
 
    if detect_rabbit
 
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"
 
78
 
 
79
        BRIDGE_IP=127.0.0.1
 
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/"
 
83
 
 
84
        if detect_rabbit
44
85
        then
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
 
89
        else
 
90
            echo "qpid detected, configuring $conf_path for qpid" >&2
 
91
            iniset $conf_path DEFAULT rpc_backend heat.openstack.common.rpc.impl_qpid
48
92
        fi
49
93
    fi
50
94
}
55
99
 
56
100
    for fn in $(ls $dir); do
57
101
        f=$dir/$fn
 
102
        target=$prefix/$f
 
103
        if [ $fn = 'heat.conf.sample' ]; then
 
104
            target=$prefix/$dir/heat.conf
 
105
        fi
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
63
 
            diff -u $prefix/$f $f
 
109
        elif [ -f $target ]; then
 
110
            echo "NOT replacing existing config file $target" >&2
 
111
            diff -u $target $f
64
112
        else
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
69
117
            fi
70
 
            sed_if_rabbit $prefix/$f
71
118
        fi
72
119
    done
73
120
}
74
121
 
75
122
install_dir etc $CONF_PREFIX
76
123
 
77
 
./setup.py install >/dev/null
 
124
python setup.py install >/dev/null
78
125
rm -rf build heat.egg-info