summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-heat_git.bb
blob: 00709283a652b86f4e4fc747f0e5b8b324949142 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
DESCRIPTION = "OpenStack Orchestration"
HOMEPAGE = "https://launchpad.net/heat"
SECTION = "devel/python"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2"

SRCNAME = "heat"

SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=master;protocol=https \
           file://heat.conf \
           file://heat.init \
           file://autoscaling_example.template \
           file://one_vm_example.template \
           file://two_vms_example.template \
           file://heat-tests-change-project_dir-path.patch \
"

SRCREV = "4348b7ababd1048e17ec354ca38c903c908cd74e"
PV = "5.0.0+git${SRCPV}"
S = "${WORKDIR}/git"

SERVICECREATE_PACKAGES = "${SRCNAME}-setup ${SRCNAME}-templates ${SRCNAME}-cfn"
KEYSTONE_HOST="${CONTROLLER_IP}"

# USERCREATE_PARAM and SERVICECREATE_PARAM contain the list of parameters to be set.
# If the flag for a parameter in the list is not set here, the default value will be given to that parameter.
# Parameters not in the list will be set to empty.

USERCREATE_PARAM_${SRCNAME}-setup = "name pass tenant role email"
SERVICECREATE_PARAM_${SRCNAME}-setup = "name type description region publicurl adminurl internalurl"
python () {
    flags = {'type':'orchestration',\
             'description':'OpenStack Orchestration Service',\
             'publicurl':"'http://${KEYSTONE_HOST}:8004/v1/\$(tenant_id)s'",\
             'adminurl':"'http://${KEYSTONE_HOST}:8004/v1/\$(tenant_id)s'",\
             'internalurl':"'http://${KEYSTONE_HOST}:8004/v1/\$(tenant_id)s'"}

    d.setVarFlags("SERVICECREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags)
}

# heat stack template user role
USERCREATE_PARAM_${SRCNAME}-templates = "role"
python () {
    flags = {'role':'heat_stack_user'}
    d.setVarFlags("USERCREATE_PARAM_%s-templates" % d.getVar('SRCNAME',True), flags)
}

# api-cfn service
SERVICECREATE_PARAM_${SRCNAME}-cfn = "name type description region publicurl adminurl internalurl"
python () {
    flags = {'name':'heat-cfn',\
             'type':'cloudformation',\
             'description':'OpenStack Cloudformation Service',\
             'publicurl':"'http://${KEYSTONE_HOST}:8000/v1'",\
             'adminurl':"'http://${KEYSTONE_HOST}:8000/v1'",\
             'internalurl':"'http://${KEYSTONE_HOST}:8000/v1'"}
    d.setVarFlags("SERVICECREATE_PARAM_%s-cfn" % d.getVar('SRCNAME',True), flags)
}

do_install:append() {
    TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME}
    HEAT_CONF_DIR=${D}${sysconfdir}/${SRCNAME}

    install -d ${HEAT_CONF_DIR}
    install -m 600 ${WORKDIR}/heat.conf ${HEAT_CONF_DIR}
    install -m 600 ${TEMPLATE_CONF_DIR}/*.json ${HEAT_CONF_DIR}
    install -d ${HEAT_CONF_DIR}/templates
    install -m 600 ${TEMPLATE_CONF_DIR}/templates/* ${HEAT_CONF_DIR}/templates
    install -m 600 ${WORKDIR}/*.template ${HEAT_CONF_DIR}/templates
    install -d ${HEAT_CONF_DIR}/environment.d
    install -m 600 ${TEMPLATE_CONF_DIR}/environment.d/* ${HEAT_CONF_DIR}/environment.d
    install -m 664 ${TEMPLATE_CONF_DIR}/api-paste.ini ${HEAT_CONF_DIR}
    sed -e "s:%SERVICE_TENANT_NAME%:${SERVICE_TENANT_NAME}:g" \
	-i ${HEAT_CONF_DIR}/api-paste.ini
    sed -e "s:%SERVICE_USER%:${SRCNAME}:g" -i ${HEAT_CONF_DIR}/api-paste.ini
    sed -e "s:%SERVICE_PASSWORD%:${SERVICE_PASSWORD}:g" -i ${HEAT_CONF_DIR}/api-paste.ini
    sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${HEAT_CONF_DIR}/api-paste.ini

    sed -e "s:%DB_USER%:${DB_USER}:g" -i ${HEAT_CONF_DIR}/heat.conf
    sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${HEAT_CONF_DIR}/heat.conf

    sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${HEAT_CONF_DIR}/heat.conf
    sed -e "s:%CONTROLLER_HOST%:${CONTROLLER_HOST}:g" -i ${HEAT_CONF_DIR}/heat.conf

    sed -e "s:%COMPUTE_IP%:${COMPUTE_IP}:g" -i ${HEAT_CONF_DIR}/heat.conf
    sed -e "s:%COMPUTE_HOST%:${COMPUTE_HOST}:g" -i ${HEAT_CONF_DIR}/heat.conf

    sed -e "s:%ADMIN_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${HEAT_CONF_DIR}/heat.conf
    sed -e "s:%SERVICE_TENANT_NAME%:${SERVICE_TENANT_NAME}:g" -i ${HEAT_CONF_DIR}/heat.conf

    if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
        install -d ${D}${sysconfdir}/init.d

        sed 's:@suffix@:api:' < ${WORKDIR}/heat.init >${WORKDIR}/heat-api.init.sh
        install -m 0755 ${WORKDIR}/heat-api.init.sh ${D}${sysconfdir}/init.d/heat-api

        sed 's:@suffix@:api-cfn:' < ${WORKDIR}/heat.init >${WORKDIR}/heat-api-cfn.init.sh
        install -m 0755 ${WORKDIR}/heat-api-cfn.init.sh ${D}${sysconfdir}/init.d/heat-api-cfn

        sed 's:@suffix@:engine:' < ${WORKDIR}/heat.init >${WORKDIR}/heat-engine.init.sh
        install -m 0755 ${WORKDIR}/heat-engine.init.sh ${D}${sysconfdir}/init.d/heat-engine
    fi

    if [ -e "run_tests.sh" ]; then
        cp run_tests.sh ${HEAT_CONF_DIR}
    fi
}

pkg_postinst:${SRCNAME}-setup () {
    if [ -z "$D" ]; then
	# This is to make sure postgres is configured and running
	if ! pidof postmaster > /dev/null; then
	   /etc/init.d/postgresql-init
	   /etc/init.d/postgresql start
	   sleep 2
	fi

	mkdir /var/log/heat
	sudo -u postgres createdb heat
	heat-manage db_sync
    fi
}

inherit setuptools3 identity hosts update-rc.d default_configs monitor

PACKAGES += "${SRCNAME}-tests ${SRCNAME}-templates ${SRCNAME}-common ${SRCNAME}-api ${SRCNAME}-api-cfn ${SRCNAME}-engine"
PACKAGES += "${SRCNAME}-setup"
PACKAGES += "${SRCNAME}-cfn"

RDEPENDS:${SRCNAME}-tests += " bash"

ALLOW_EMPTY:${SRCNAME}-tests = "1"
ALLOW_EMPTY:${SRCNAME}-setup = "1"
ALLOW_EMPTY:${SRCNAME}-templates = "1"
ALLOW_EMPTY:${SRCNAME}-cfn = "1"

FILES:${PN} = "${libdir}/*"

FILES:${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh"

FILES:${SRCNAME}-templates = "${sysconfdir}/${SRCNAME}/templates/*"

FILES:${SRCNAME}-common = "${sysconfdir}/${SRCNAME}/* \
"

FILES:${SRCNAME}-api = "${bindir}/heat-api \
                        ${sysconfdir}/init.d/heat-api \
"
FILES:${SRCNAME}-api-cfn = "${bindir}/heat-api-cfn \
                           ${sysconfdir}/init.d/heat-api-cfn \
"

FILES:${SRCNAME}-engine = "${bindir}/heat-engine \
                           ${bindir}/* \
                           ${sysconfdir}/init.d/heat-engine \
"

DEPENDS += " \
        python-pip \
        python-pbr \
        "

# Satisfy setup.py 'setup_requires'
DEPENDS += " \
        python-pbr-native \
        "

RDEPENDS:${PN} += " \
        python-heatclient \
        python-sqlalchemy \
	python-amqplib \
	python-anyjson \
	python-eventlet \
	python-kombu \
	python-lxml \
	python-routes \
	python-webob \
	python-greenlet \
	python-lockfile \
	python-pastedeploy \
	python-paste \
	python-sqlalchemy-migrate \
	python-stevedore \
	python-suds-jurko \
	python-paramiko \
	python-babel \
	python-iso8601 \
	python-setuptools3-git \
	python-glanceclient \
	python-keystoneclient \
	python-swiftclient \
	python-oslo.config \
        python-msgpack \
        python-pecan \
        python-amqp \
        python-singledispatch \
        python-flask \
        python-werkzeug \
        python-itsdangerous \
        python-happybase \
        python-wsme \
        python-eventlet \
        python-pymongo \
        python-thrift \
        python-simplegeneric \
        python-webtest \
        python-waitress \
        python-pyyaml \
        python-pip \
        python-pytz \
        python-pbr \
        python-oslo.log \
        python-croniter \
        python-cryptography \
        python-keystonemiddleware \
        python-netaddr \
        python-oslo.cache \
        python-oslo.concurrency \
        python-oslo.context \
        python-oslo.db \
        python-oslo.i18n \
        python-oslo.messaging \
        python-oslo.middleware \
        python-oslo.policy \
        python-oslo.reports \
        python-oslo.serialization \
        python-oslo.service \
        python-oslo.utils \
        python-osprofiler \
        python-oslo.versionedobjects \
        python-pycrypto \
        python-barbicanclient \
        python-ceilometerclient \
        python-cinderclient \
        python-designateclient \
        python-magnumclient \
        python-manilaclient \
        python-mistralclient \
        python-neutronclient \
        python-novaclient \
        python-saharaclient \
        python-troveclient \
        python-zaqarclient \
        python-requests \
        python-six \
        bash \
	"

RDEPENDS:${SRCNAME}-engine = "${PN} ${SRCNAME}-templates ${SRCNAME}-common postgresql postgresql-client python-psycopg2 tgt ${SRCNAME}-cfn bash"
RDEPENDS:${SRCNAME}-api = "${SRCNAME}-engine"
RDEPENDS:${SRCNAME}-api-cfn = "${SRCNAME}-engine"
RDEPENDS:${SRCNAME}-setup = "postgresql sudo ${SRCNAME}-engine"
RDEPENDS:${SRCNAME}-templates = "postgresql sudo"
RDEPENDS:${SRCNAME}-cfn = "postgresql sudo"

INITSCRIPT_PACKAGES = "${SRCNAME}-api ${SRCNAME}-api-cfn ${SRCNAME}-engine"
INITSCRIPT_NAME:${SRCNAME}-api = "${SRCNAME}-api"
INITSCRIPT_PARAMS:${SRCNAME}-api = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
INITSCRIPT_NAME:${SRCNAME}-api-cfn = "${SRCNAME}-api-cfn"
INITSCRIPT_PARAMS:${SRCNAME}-api-cfn = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
INITSCRIPT_NAME:${SRCNAME}-engine = "${SRCNAME}-engine"
INITSCRIPT_PARAMS:${SRCNAME}-engine = "${OS_DEFAULT_INITSCRIPT_PARAMS}"

MONITOR_SERVICE_PACKAGES = "${SRCNAME}"
MONITOR_SERVICE_${SRCNAME} = "heat"