Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-devtools / python / python-barbican_git.bb
1
2 DESCRIPTION = "Barbican is a ReST API designed for the secure storage, provisioning and management of secrets."
3 HOMEPAGE = "https://wiki.openstack.org/wiki/Barbican"
4 SECTION = "devel/python"
5 LICENSE = "Apache-2.0"
6 LIC_FILES_CHKSUM = "file://LICENSE;md5=fc8be9e7dffe97390d1216b01fd0be01"
7
8 PR = "r0"
9 SRCNAME = "barbican"
10 BARBICAN_MAX_PACKET_SIZE ?= "65535"
11
12 SRC_URI = " \
13         git://github.com/openstack/barbican.git;branch=${BRANCH} \
14         file://${BPN}/barbican-fix-path-to-find-configuration-files.patch \
15         file://${BPN}/openstack-barbican-api.service \
16         file://${BPN}/openstack-barbican-worker.service \
17         file://${BPN}/openstack-barbican-keystone-listener.service \
18         file://${BPN}/gunicorn-config.py \
19         "
20
21 SRCREV = "4c0ddda941289fba8e5ec4341b5d02d155d46162"
22 BRANCH = "stable/stein"
23 PV = "8.0.0+git${SRCPV}"
24 S = "${WORKDIR}/git"
25
26 inherit update-rc.d setuptools identity hosts useradd default_configs monitor systemd
27
28 SYSTEMD_SERVICE_${SRCNAME} = " \
29         openstack-barbican-api.service \
30         openstack-barbican-worker.service \
31         openstack-barbican-keystone-listener.service \
32         "
33
34 SYSTEMD_AUTO_ENABLE_${SRCNAME} = "disable"
35
36 SERVICECREATE_PACKAGES = "${SRCNAME}-setup"
37 KEYSTONE_HOST="${CONTROLLER_IP}"
38
39 # USERCREATE_PARAM and SERVICECREATE_PARAM contain the list of parameters to be set.
40 # If the flag for a parameter in the list is not set here, the default value will be given to that parameter.
41 # Parameters not in the list will be set to empty.
42
43 USERCREATE_PARAM_${SRCNAME}-setup = "name pass tenant role email"
44 SERVICECREATE_PARAM_${SRCNAME}-setup = "name type description region publicurl adminurl internalurl"
45 python () {
46     flags = {'type':'keystore',\
47              'description':'Barbican Key Management Service',\
48              'publicurl':"'http://${KEYSTONE_HOST}:9311/v1'",\
49              'adminurl':"'http://${KEYSTONE_HOST}:9312/v1'",\
50              'internalurl':"'http://${KEYSTONE_HOST}:9313/v1'"}
51     d.setVarFlags("SERVICECREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags)
52 }
53 SERVICECREATE_PACKAGES[vardeps] += "KEYSTONE_HOST"
54
55 do_install_append() {
56     TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME}
57     BARBICAN_CONF_DIR=${D}${sysconfdir}/${SRCNAME}
58
59     install -d ${BARBICAN_CONF_DIR}
60     cp -r ${TEMPLATE_CONF_DIR}/* ${BARBICAN_CONF_DIR}
61
62     install -d ${D}${localstatedir}/lib/barbican
63
64     # Install the systemd service files
65     install -d ${D}${systemd_system_unitdir}/
66     install -m 644 ${WORKDIR}/${BPN}/*.service ${D}${systemd_system_unitdir}
67
68     # python-gunicorn and gunicorn-config.py are required by openstack-barbican-api.service
69     install -m 644 ${WORKDIR}/${PN}/gunicorn-config.py ${BARBICAN_CONF_DIR}
70
71     # Modify barbican-api-paste.ini for gunicorn
72     echo '[server:main]' >> ${BARBICAN_CONF_DIR}/barbican-api-paste.ini
73     echo 'use = egg:gunicorn#main' >> ${BARBICAN_CONF_DIR}/barbican-api-paste.ini
74
75     sed -e "s:%BARBICAN_CONF_DIR%:${sysconfdir}/${SRCNAME}:g" \
76         -i ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/tests/api/test_resources_policy.py
77
78     install -m 0755 -d ${D}/${sysconfdir}/tmpfiles.d
79     echo "d ${localstatedir}/log/barbican 0750 barbican barbican -" >> ${D}/${sysconfdir}/tmpfiles.d/barbican.conf
80 }
81
82 USERADD_PACKAGES = "${PN}"
83 GROUPADD_PARAM_${PN} = "--system barbican"
84 USERADD_PARAM_${PN}  = "--system --home /var/lib/barbican -g barbican \
85                         --no-create-home --shell /bin/false barbican"
86
87 PACKAGES += "${SRCNAME} \
88              ${SRCNAME}-setup "
89
90 FILES_${PN} = "${libdir}/* \
91 "
92 FILES_${SRCNAME} = "${sysconfdir}/${SRCNAME}/* \
93                     ${sysconfdir}/init.d/barbican-api \
94                     ${bindir} \
95                     ${bindir}/* \
96                     ${localstatedir}/* \
97                     ${systemd_system_unitdir} \
98 "
99
100 ALLOW_EMPTY_${SRCNAME}-setup = "1"
101 pkg_postinst_${SRCNAME}-setup () {
102     if [ -z "$D" ]; then
103         chown -R barbican:barbican ${sysconfdir}/${SRCNAME}
104         chown -R barbican:barbican ${localstatedir}/lib/barbican
105     fi
106 }
107
108 DEPENDS += " \
109         python-pip \
110         python-pbr-native \
111         "
112
113 RDEPENDS_${SRCNAME} = "${PN} \
114                        ${SRCNAME}-setup \
115                        uwsgi \
116                        python-falcon \
117                        python-oslo.messaging"
118
119 RDEPENDS_${PN} += " \
120         python-pip \
121         python-pbr \
122         python-alembic \
123         python-babel \
124         python-eventlet \
125         python-falcon \
126         python-iso8601 \
127         python-jsonschema \
128         python-kombu \
129         python-netaddr \
130         python-pastedeploy \
131         python-paste \
132         python-pycrypto \
133         python-keystoneclient \
134         python-sqlalchemy \
135         python-stevedore \
136         python-webob \
137         python-wsgiref \
138         python-barbicanclient \
139         python-gunicorn \
140         python-castellan \
141         python-ldap3 \
142         "
143
144 INITSCRIPT_PACKAGES = "${SRCNAME}"
145 INITSCRIPT_NAME_${SRCNAME} = "barbican-api"
146 INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
147
148 MONITOR_SERVICE_PACKAGES = "${SRCNAME}"
149 MONITOR_SERVICE_${SRCNAME} = "barbican"
150
151
152 FILES_${PN}_append = " \
153         ${datadir}/ \
154         ${sysconfdir}/tmpfiles.d/barbican.conf \
155         "