Do not start unnecessary async workers
- Avoids MySQL deadlock
- Do not autocreate DB
Change-Id: I642e37563a31cc20309a4be4819499ac482413ac
diff --git a/barbican/files/ocata/barbican.conf.Debian b/barbican/files/ocata/barbican.conf.Debian
index c0da2bb..3b2054c 100644
--- a/barbican/files/ocata/barbican.conf.Debian
+++ b/barbican/files/ocata/barbican.conf.Debian
@@ -41,6 +41,7 @@
# Note: For absolute addresses, use '////' slashes after 'sqlite:'
# Uncomment for a more global development environment
sql_connection = {{ server.database.engine }}://{{ server.database.user }}:{{ server.database.password }}@{{ server.database.host }}/{{ server.database.name }}
+db_auto_create = False
# Period in seconds after which SQLAlchemy should reestablish its connection
# to the database.
diff --git a/barbican/map.jinja b/barbican/map.jinja
index bb9c15f..9bb4730 100644
--- a/barbican/map.jinja
+++ b/barbican/map.jinja
@@ -13,7 +13,6 @@
- barbican-worker
services:
- barbican-keystone-listener
- - barbican-worker
dogtag_pkgs:
- libnss3-tools
- python-nss
diff --git a/barbican/server.sls b/barbican/server.sls
index cbf613b..936c7e3 100644
--- a/barbican/server.sls
+++ b/barbican/server.sls
@@ -12,6 +12,16 @@
- require:
- pkg: barbican_server_packages
+barbican_syncdb:
+ cmd.run:
+ - name: barbican-manage db upgrade
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
+ - require:
+ - file: /etc/barbican/barbican.conf
+ - pkg: barbican_server_packages
+
/etc/apache2/conf-enabled/barbican-api.conf:
file.absent:
- require:
@@ -38,7 +48,6 @@
- file: /etc/barbican/barbican.conf
- file: /etc/apache2/sites-available/barbican-api.conf
-
barbican_server_services:
service.running:
- names: {{ server.services }}
@@ -46,6 +55,22 @@
- watch:
- file: /etc/barbican/barbican.conf
+{%- if server.get('async_queues_enable', False) %}
+barbican_async_workers_enable:
+ service.running:
+ - names:
+ - barbican-worker
+ - enable: true
+ - watch:
+ - file: /etc/barbican/barbican.conf
+{%- else %}
+barbican_async_workers_disable:
+ service.dead:
+ - names:
+ - barbican-worker
+ - enable: false
+{%- endif %}
+
{%- if 'dogtag' in server.get('plugin', {}) %}
barbican_dogtag_packages:
pkg.installed: