Fix dependencies for ceilometer-upgrade
If ceilometer and gnocchi are running on the same host under apache,
ceilometer-upgrade may fail because of apache restart in the same time,
so this patch move ceilometer-upgrade command to be executed before
apache restart.
Change-Id: Ie2d71778e46859a14c2e63cd1a78fca3c47cecc6
Related-Prod: https://mirantis.jira.com/browse/PROD-18473
diff --git a/ceilometer/server.sls b/ceilometer/server.sls
index 8c5a683..3001d05 100644
--- a/ceilometer/server.sls
+++ b/ceilometer/server.sls
@@ -229,6 +229,14 @@
- file: /etc/ceilometer/event_pipeline.yaml
- file: /etc/ceilometer/gabbi_pipeline.yaml
- file: /etc/ceilometer/pipeline.yaml
+ # ceilometer-upgrade requires operational Gnocchi service API,
+ # which can be run on the same node as Ceilometer under apache,
+ # the command is executed only when Gnocchi is enabled.
+ {%- set gnocchi_publisher = server.get('publisher', {}).get('gnocchi', {}) %}
+ {%- if gnocchi_publisher.get('create_resources', False) and gnocchi_publisher.get('enabled', False) %}
+ - require:
+ - ceilometer_upgrade
+ {%- endif %}
{%- endif %}