diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-04-23 23:31:25 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-04-23 23:31:25 -0400 |
commit | 2ba40be73f3abf28ffb0c8d1b3fd65dbf237ac4c (patch) | |
tree | d6009e1746fba6fcd78e689e018e645add451752 /meta-openstack/recipes-devtools/python/python-barbican | |
parent | 693b0eb259816510b5fc6123ef6cc72138154b31 (diff) | |
download | meta-cloud-services-2ba40be73f3abf28ffb0c8d1b3fd65dbf237ac4c.tar.gz |
barbican: ReST API designed for the secure storage, provisioning and management of secrets
Introduce the barbican package: https://wiki.openstack.org/wiki/Barbican, to
support the management of keys and secrets on an OpenStack system.
The barbican api service can be started with the packaged initscript, and has
been validated against the barbican quick start guide.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-barbican')
-rw-r--r-- | meta-openstack/recipes-devtools/python/python-barbican/barbican.init | 101 |
1 files changed, 101 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 | ||