diff options
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-barbican/barbican.init | 101 | ||||
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-barbican_git.bb | 100 |
2 files changed, 201 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-barbican/barbican.init b/meta-openstack/recipes-devtools/python/python-barbican/barbican.init new file mode 100644 index 0000000..ba3a019 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-barbican/barbican.init | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | ### BEGIN INIT INFO | ||
| 4 | # Provides: barbican barbican-api | ||
| 5 | # Required-Start: $remote_fs $syslog | ||
| 6 | # Required-Stop: $remote_fs $syslog | ||
| 7 | # Default-Start: 3 5 | ||
| 8 | # Default-Stop: 0 1 2 6 | ||
| 9 | # Short-Description: OpenStack Secrets (barbican) - @suffix@ | ||
| 10 | # Description: OpenStack Secrets (barbican) - @suffix@ | ||
| 11 | ### END INIT INFO | ||
| 12 | |||
| 13 | SUFFIX="@suffix@" | ||
| 14 | DESC="barbican-@suffix@" | ||
| 15 | PIDFILE="/var/run/barbican/barbican-$SUFFIX.pid" | ||
| 16 | CONFIG_DIR="/etc/barbican" | ||
| 17 | UWSGI="/usr/bin/uwsgi" | ||
| 18 | EXEC="--master --emperor $CONFIG_DIR/vassals" | ||
| 19 | |||
| 20 | if [ ! -d /var/run/barbican ]; then | ||
| 21 | mkdir -p /var/run/barbican | ||
| 22 | chown barbican:barbican /var/run/barbican | ||
| 23 | fi | ||
| 24 | |||
| 25 | start () | ||
| 26 | { | ||
| 27 | if [ -e $PIDFILE ]; then | ||
| 28 | PIDDIR=/proc/$(cat $PIDFILE) | ||
| 29 | if [ -d ${PIDDIR} ]; then | ||
| 30 | echo "$DESC already running." | ||
| 31 | exit 1 | ||
| 32 | else | ||
| 33 | echo "Removing stale PID file $PIDFILE" | ||
| 34 | rm -f $PIDFILE | ||
| 35 | fi | ||
| 36 | fi | ||
| 37 | PIDDIR=`dirname $PIDFILE` | ||
| 38 | if [ ! -d $PIDDIR ]; then | ||
| 39 | mkdir -p $PIDDIR | ||
| 40 | chown barbican $PIDDIR | ||
| 41 | fi | ||
| 42 | if [ ! -d /var/log/barbican ]; then | ||
| 43 | mkdir /var/log/barbican | ||
| 44 | fi | ||
| 45 | echo -n "Starting $DESC..." | ||
| 46 | |||
| 47 | start-stop-daemon --start --quiet --background \ | ||
| 48 | --exec ${UWSGI} -- --pidfile ${PIDFILE} ${EXEC} | ||
| 49 | |||
| 50 | if [ $? -eq 0 ]; then | ||
| 51 | echo "done." | ||
| 52 | else | ||
| 53 | echo "failed." | ||
| 54 | fi | ||
| 55 | } | ||
| 56 | |||
| 57 | stop () | ||
| 58 | { | ||
| 59 | echo -n "Stopping $DESC..." | ||
| 60 | start-stop-daemon --stop --signal 9 --quiet --pidfile $PIDFILE | ||
| 61 | if [ $? -eq 0 ]; then | ||
| 62 | echo "done." | ||
| 63 | else | ||
| 64 | echo "failed." | ||
| 65 | fi | ||
| 66 | rm -f $PIDFILE | ||
| 67 | } | ||
| 68 | |||
| 69 | status() | ||
| 70 | { | ||
| 71 | pid=`cat $PIDFILE 2>/dev/null` | ||
| 72 | if [ -n "$pid" ]; then | ||
| 73 | if ps -p $pid >&- ; then | ||
| 74 | echo "$DESC is running" | ||
| 75 | return | ||
| 76 | fi | ||
| 77 | fi | ||
| 78 | echo "$DESC is not running" | ||
| 79 | } | ||
| 80 | |||
| 81 | case "$1" in | ||
| 82 | start) | ||
| 83 | start | ||
| 84 | ;; | ||
| 85 | stop) | ||
| 86 | stop | ||
| 87 | ;; | ||
| 88 | restart|force-reload|reload) | ||
| 89 | stop | ||
| 90 | start | ||
| 91 | ;; | ||
| 92 | status) | ||
| 93 | status | ||
| 94 | ;; | ||
| 95 | *) | ||
| 96 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | ||
| 97 | exit 1 | ||
| 98 | ;; | ||
| 99 | esac | ||
| 100 | |||
| 101 | exit 0 | ||
diff --git a/meta-openstack/recipes-devtools/python/python-barbican_git.bb b/meta-openstack/recipes-devtools/python/python-barbican_git.bb new file mode 100644 index 0000000..838346c --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-barbican_git.bb | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | DESCRIPTION = "Barbican is a ReST API designed for the secure storage, provisioning and management of secrets." | ||
| 2 | HOMEPAGE = "https://wiki.openstack.org/wiki/Barbican" | ||
| 3 | SECTION = "devel/python" | ||
| 4 | LICENSE = "Apache-2.0" | ||
| 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=fc8be9e7dffe97390d1216b01fd0be01" | ||
| 6 | |||
| 7 | PR = "r0" | ||
| 8 | SRCNAME = "barbican" | ||
| 9 | |||
| 10 | SRC_URI = "git://github.com/stackforge/barbican.git;branch=master \ | ||
| 11 | file://barbican.init \ | ||
| 12 | " | ||
| 13 | |||
| 14 | SRCREV="177d4499af6b261f48814503e3565f433e86cc66" | ||
| 15 | PV="2014.1+git${SRCPV}" | ||
| 16 | S = "${WORKDIR}/git" | ||
| 17 | |||
| 18 | inherit update-rc.d setuptools identity hosts useradd default_configs | ||
| 19 | |||
| 20 | do_install_append() { | ||
| 21 | TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME} | ||
| 22 | BARBICAN_CONF_DIR=${D}${sysconfdir}/${SRCNAME} | ||
| 23 | |||
| 24 | install -d ${BARBICAN_CONF_DIR} | ||
| 25 | cp -r ${TEMPLATE_CONF_DIR}/* ${BARBICAN_CONF_DIR} | ||
| 26 | |||
| 27 | install -d ${D}${localstatedir}/lib/barbican | ||
| 28 | |||
| 29 | if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 30 | install -d ${D}${sysconfdir}/init.d | ||
| 31 | |||
| 32 | for binary in api; do | ||
| 33 | sed "s:@suffix@:$binary:" < ${WORKDIR}/barbican.init >${WORKDIR}/barbican-$binary.init.sh | ||
| 34 | install -m 0755 ${WORKDIR}/barbican-$binary.init.sh ${D}${sysconfdir}/init.d/barbican-$binary | ||
| 35 | done | ||
| 36 | fi | ||
| 37 | } | ||
| 38 | |||
| 39 | USERADD_PACKAGES = "${PN}" | ||
| 40 | GROUPADD_PARAM_${PN} = "--system barbican" | ||
| 41 | USERADD_PARAM_${PN} = "--system --home /var/lib/barbican -g barbican \ | ||
| 42 | --no-create-home --shell /bin/false barbican" | ||
| 43 | |||
| 44 | PACKAGES += "${SRCNAME} \ | ||
| 45 | ${SRCNAME}-setup " | ||
| 46 | |||
| 47 | FILES_${PN} = "${libdir}/* \ | ||
| 48 | " | ||
| 49 | FILES_${SRCNAME} = "${sysconfdir}/${SRCNAME}/* \ | ||
| 50 | ${sysconfdir}/init.d/barbican-api \ | ||
| 51 | ${bindir}/* \ | ||
| 52 | ${localstatedir}/* \ | ||
| 53 | " | ||
| 54 | |||
| 55 | ALLOW_EMPTY_${SRCNAME}-setup = "1" | ||
| 56 | pkg_postinst_${SRCNAME}-setup () { | ||
| 57 | if [ "x$D" != "x" ]; then | ||
| 58 | exit 1 | ||
| 59 | fi | ||
| 60 | |||
| 61 | chown -R barbican:barbican ${sysconfdir}/${SRCNAME} | ||
| 62 | chown -R barbican:barbican ${localstatedir}/lib/barbican | ||
| 63 | } | ||
| 64 | |||
| 65 | DEPENDS += " \ | ||
| 66 | python-pip \ | ||
| 67 | python-pbr \ | ||
| 68 | " | ||
| 69 | |||
| 70 | RDEPENDS_${SRCNAME} = "${PN} \ | ||
| 71 | ${SRCNAME}-setup \ | ||
| 72 | uwsgi \ | ||
| 73 | python-falcon \ | ||
| 74 | python-oslo.messaging" | ||
| 75 | |||
| 76 | RDEPENDS_${PN} += " \ | ||
| 77 | python-pip \ | ||
| 78 | python-pbr \ | ||
| 79 | python-alembic \ | ||
| 80 | python-babel \ | ||
| 81 | python-eventlet \ | ||
| 82 | python-falcon \ | ||
| 83 | python-iso8601 \ | ||
| 84 | python-jsonschema \ | ||
| 85 | python-kombu \ | ||
| 86 | python-netaddr \ | ||
| 87 | python-pastedeploy \ | ||
| 88 | python-paste \ | ||
| 89 | python-pycrypto \ | ||
| 90 | python-pysqlite \ | ||
| 91 | python-keystoneclient \ | ||
| 92 | python-sqlalchemy \ | ||
| 93 | python-stevedore \ | ||
| 94 | python-webob \ | ||
| 95 | python-wsgiref \ | ||
| 96 | " | ||
| 97 | |||
| 98 | INITSCRIPT_PACKAGES = "${SRCNAME}" | ||
| 99 | INITSCRIPT_NAME_${SRCNAME} = "barbican-api" | ||
| 100 | INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}" | ||
