2 ## Copyright (C) 2019 Wind River Systems, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 DESCRIPTION = "Barbican is a ReST API designed for the secure storage, provisioning and management of secrets."
17 HOMEPAGE = "https://wiki.openstack.org/wiki/Barbican"
18 SECTION = "devel/python"
19 LICENSE = "Apache-2.0"
20 LIC_FILES_CHKSUM = "file://LICENSE;md5=fc8be9e7dffe97390d1216b01fd0be01"
24 BARBICAN_MAX_PACKET_SIZE ?= "65535"
27 git://github.com/openstack/barbican.git;branch=${BRANCH} \
28 file://${BPN}/barbican-fix-path-to-find-configuration-files.patch \
29 file://${BPN}/openstack-barbican-api.service \
30 file://${BPN}/openstack-barbican-worker.service \
31 file://${BPN}/openstack-barbican-keystone-listener.service \
32 file://${BPN}/gunicorn-config.py \
35 SRCREV = "4c0ddda941289fba8e5ec4341b5d02d155d46162"
36 BRANCH = "stable/stein"
37 PV = "8.0.0+git${SRCPV}"
40 inherit update-rc.d setuptools identity hosts useradd default_configs monitor systemd
42 SYSTEMD_SERVICE_${SRCNAME} = " \
43 openstack-barbican-api.service \
44 openstack-barbican-worker.service \
45 openstack-barbican-keystone-listener.service \
48 SYSTEMD_AUTO_ENABLE_${SRCNAME} = "disable"
50 SERVICECREATE_PACKAGES = "${SRCNAME}-setup"
51 KEYSTONE_HOST="${CONTROLLER_IP}"
53 # USERCREATE_PARAM and SERVICECREATE_PARAM contain the list of parameters to be set.
54 # If the flag for a parameter in the list is not set here, the default value will be given to that parameter.
55 # Parameters not in the list will be set to empty.
57 USERCREATE_PARAM_${SRCNAME}-setup = "name pass tenant role email"
58 SERVICECREATE_PARAM_${SRCNAME}-setup = "name type description region publicurl adminurl internalurl"
60 flags = {'type':'keystore',\
61 'description':'Barbican Key Management Service',\
62 'publicurl':"'http://${KEYSTONE_HOST}:9311/v1'",\
63 'adminurl':"'http://${KEYSTONE_HOST}:9312/v1'",\
64 'internalurl':"'http://${KEYSTONE_HOST}:9313/v1'"}
65 d.setVarFlags("SERVICECREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags)
67 SERVICECREATE_PACKAGES[vardeps] += "KEYSTONE_HOST"
70 TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME}
71 BARBICAN_CONF_DIR=${D}${sysconfdir}/${SRCNAME}
73 install -d ${BARBICAN_CONF_DIR}
74 cp -r ${TEMPLATE_CONF_DIR}/* ${BARBICAN_CONF_DIR}
76 install -d ${D}${localstatedir}/lib/barbican
78 # Install the systemd service files
79 install -d ${D}${systemd_system_unitdir}/
80 install -m 644 ${WORKDIR}/${BPN}/*.service ${D}${systemd_system_unitdir}
82 # python-gunicorn and gunicorn-config.py are required by openstack-barbican-api.service
83 install -m 644 ${WORKDIR}/${PN}/gunicorn-config.py ${BARBICAN_CONF_DIR}
85 # Modify barbican-api-paste.ini for gunicorn
86 echo '[server:main]' >> ${BARBICAN_CONF_DIR}/barbican-api-paste.ini
87 echo 'use = egg:gunicorn#main' >> ${BARBICAN_CONF_DIR}/barbican-api-paste.ini
89 sed -e "s:%BARBICAN_CONF_DIR%:${sysconfdir}/${SRCNAME}:g" \
90 -i ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/tests/api/test_resources_policy.py
92 install -m 0755 -d ${D}/${sysconfdir}/tmpfiles.d
93 echo "d ${localstatedir}/log/barbican 0750 barbican barbican -" >> ${D}/${sysconfdir}/tmpfiles.d/barbican.conf
96 USERADD_PACKAGES = "${PN}"
97 GROUPADD_PARAM_${PN} = "--system barbican"
98 USERADD_PARAM_${PN} = "--system --home /var/lib/barbican -g barbican \
99 --no-create-home --shell /bin/false barbican"
101 PACKAGES += "${SRCNAME} \
104 FILES_${PN} = "${libdir}/* \
106 FILES_${SRCNAME} = "${sysconfdir}/${SRCNAME}/* \
107 ${sysconfdir}/init.d/barbican-api \
111 ${systemd_system_unitdir} \
112 ${sysconfdir}/tmpfiles.d/barbican.conf \
115 ALLOW_EMPTY_${SRCNAME}-setup = "1"
116 pkg_postinst_${SRCNAME}-setup () {
118 chown -R barbican:barbican ${sysconfdir}/${SRCNAME}
119 chown -R barbican:barbican ${localstatedir}/lib/barbican
129 openstack-barbican-api \
133 RDEPENDS_${SRCNAME} = "${PN} \
137 python-oslo.messaging"
139 RDEPENDS_${PN} += " \
153 python-keystoneclient \
158 python-barbicanclient \
164 INITSCRIPT_PACKAGES = "${SRCNAME}"
165 INITSCRIPT_NAME_${SRCNAME} = "barbican-api"
166 INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
168 MONITOR_SERVICE_PACKAGES = "${SRCNAME}"
169 MONITOR_SERVICE_${SRCNAME} = "barbican"
172 FILES_${PN}_append = " ${datadir}/"