File: neutron-dynamic-routing-common.postinst.in

package info (click to toggle)
neutron-dynamic-routing 2:15.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,168 kB
  • sloc: python: 7,878; sh: 268; makefile: 41
file content (53 lines) | stat: -rw-r--r-- 1,860 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

set -e

NEUTRON_CONF="/etc/neutron/neutron.conf"
BGP_AGENT_CONF="/etc/neutron/bgp_dragent.ini"

#PKGOS-INCLUDE#

run_db_sync (){

        # Check if we are on server side of neutron
        if [ -e /etc/init.d/neutron-rpc-server ] || systemctl -q is-enabled neutron-rpc-server.service ; then
                # We have to check if connection is set in [database] config
                pkgos_inifile get ${NEUTRON_CONF} database connection
                if echo ${RET} | egrep 'mysql(\+pymysql)?:.*:.*@.*\/.*' > /dev/null; then
                        echo "===> python3-neutron-dynamic-routing-common: Now running \"neutron-db-manage --subproject neutron-dynamic-routing upgrade head\", this may take a while..."
                        su neutron -s /bin/sh -c "neutron-db-manage --subproject neutron-dynamic-routing upgrade head" || true
                else
                        echo "===> neutron-dynamic-routing-common: \"neutron-db-manage --subproject neutron-dynamic-routing upgrade head\" needs database.connection set. Sorry."
                fi
        fi

}

manage_router_id() {
        db_get neutron-dynamic-routing/router-id
        if [ -n "${RET}" ] ; then
                pkgos_inifile set ${BGP_AGENT_CONF} bgp bgp_router_id ${RET}
        fi
}

if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
        . /usr/share/debconf/confmodule

        db_get neutron-dynamic-routing/configure-dynamic-routing
        if [ "$RET" = "true" ]; then
                run_db_sync
                # Enable service_plugin bgp
                if which neutron-plugin-manage > /dev/null ; then
                        neutron-plugin-manage enable --service-plugin bgp
                fi
		manage_router_id
        fi

        db_unregister neutron-dynamic-routing/configure-dynamic-routing
        db_stop
fi

#DEBHELPER#

exit 0