Merge "Formulas testing revision 2019/10" into release/2019.2.0
diff --git a/octavia/api.sls b/octavia/api.sls
index 45c460f..cc5a26f 100644
--- a/octavia/api.sls
+++ b/octavia/api.sls
@@ -3,6 +3,9 @@
{%- if api.enabled %}
include:
+ {%- if pillar.get('apache', {}).get('server', {}).get('site', {}).octavia_api is defined %}
+ - apache
+ {%- endif %}
- octavia.db.offline_sync
- octavia._ssl.mysql
- octavia._ssl.rabbitmq
@@ -41,8 +44,8 @@
- pkg: octavia_api_packages
{%- endif %}
-
{%- if not grains.get('noservices', False) %}
+ {%- if pillar.get('apache', {}).get('server', {}).get('site', {}).octavia_api is not defined %}
octavia_api_services:
service.running:
- names: {{ api.services }}
@@ -53,6 +56,42 @@
- sls: octavia.db.offline_sync
- sls: octavia._ssl.mysql
- sls: octavia._ssl.rabbitmq
+ {%- else %}
+{# WA to point WSGI process on actual config file #}
+octavia_conf_symlink:
+ file.symlink:
+ - name: /etc/octavia/octavia.conf
+ - target: /etc/octavia/octavia_api.conf
+ - backupname: /etc/octavia/octavia.conf.backup
+ - force: true
+ - require:
+ - file: /etc/octavia/octavia_api.conf
+
+octavia_api_services:
+ service.dead:
+ - names: {{ api.services }}
+ - enable: false
+ - require:
+ - pkg: octavia_api_packages
+
+octavia_api_apache_conf_file:
+ file.exists:
+ - names:
+ - /etc/apache2/sites-available/wsgi_octavia_api.conf
+ - require:
+ - sls: apache.server.site
+ - pkg: octavia_api_packages
+
+apache_enable_octavia_api_wsgi:
+ apache_site.enabled:
+ - name: wsgi_octavia_api
+ - require:
+ - file: octavia_api_apache_conf_file
+ - service: octavia_api_services
+ - file: octavia_conf_symlink
+ - watch_in:
+ - service: apache_service
+ {%- endif %}
{%- endif %}
{%- endif %}
diff --git a/octavia/meta/telegraf.yml b/octavia/meta/telegraf.yml
index 2af7d05..50be25a 100644
--- a/octavia/meta/telegraf.yml
+++ b/octavia/meta/telegraf.yml
@@ -1,9 +1,10 @@
{%- from "octavia/map.jinja" import api with context %}
{%- if api.get('enabled', False) %}
+{%- set protocol = api.get('identity', {}).get('protocol', 'http') %}
agent:
input:
http_response:
octavia-api:
- address: "http://{{ api.bind.address|replace('0.0.0.0', '127.0.0.1') }}:{{ api.bind.port }}/"
+ address: "{{ protocol }}://{{ api.bind.address|replace('0.0.0.0', '127.0.0.1') }}:{{ api.bind.port }}/"
expected_code: 200
{%- endif %}