aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-nova-controller_2013.1.3.bb
blob: 36b5ba36a095d72c5ff9c043d38b3fa00c221310 (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
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
include python-nova.inc

PR = "r0"

FILESEXTRAPATHS := "${THISDIR}/${PYTHON_PN}"

SRC_URI += "file://nova-all \
            file://nova.conf \
            file://openrc \
           "

inherit hosts update-rc.d

#PACKAGES = "${SRCNAME}-controller ${SRCNAME}-controller-misc"
PACKAGES = "${PN} ${PN}-dbg ${SRCNAME}-controller-misc ${SRCNAME}-controller"

do_install_append() {
    if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
        install -d ${D}${sysconfdir}/init.d
        install -m 0755 ${WORKDIR}/nova-all ${D}${sysconfdir}/init.d/nova-all
    fi
}

pkg_postinst_${SRCNAME}-controller () {
    if [ "x$D" != "x" ]; then
        exit 1
    fi

    # This is to make sure postgres is configured and running
    if ! pidof postmaster > /dev/null; then
       sudo -u postgres initdb -D /etc/postgresql/
       /etc/init.d/postgresql start
       sleep 0.2
       sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'"
    fi

    sudo -u postgres createdb nova
    nova-manage db sync
}


#FILES_${SRCNAME}-controller = "${files_${SRCNAME}-controller}"
#
# If the compute is built, so we package it out of the way

#FILES_${SRCNAME}-controller-misc = "${files_${SRCNAME}-compute} 
#${files_${SRCNAME}-common} ${files_${PYTHON_PN}}"

FILES_${SRCNAME}-controller = " \
	${bindir} \
	${sysconfdir}/${SRCNAME}/* \
	${sysconfdir}/init.d/nova-all"

FILES_${SRCNAME}-controller-misc = " \
	${bindir}/nova-compute \
	${sysconfdir}/init.d/nova-compute \
	${bindir}/nova-manage \
	${bindir}/nova-rootwrap \
	${sysconfdir}/sudoers.d \
	${libdir}"

FILES_${PN} = " \
	${libdir}/python*/site-packages"

RDEPENDS_${SRCNAME}-controller = "${PYTHON_PN} ${SRCNAME}-common \
                                  postgresql postgresql-client python-psycopg2"

RCONFLICTS_${SRCNAME}-controller = "${SRCNAME}-compute"

INITSCRIPT_PACKAGES = "${SRCNAME}-controller"
INITSCRIPT_NAME_${SRCNAME}-controller = "nova-all"