Merge "Add listen directive to wsgi host"
diff --git a/apache/files/wsgi.conf b/apache/files/wsgi.conf
index d0a88ea..2a62735 100644
--- a/apache/files/wsgi.conf
+++ b/apache/files/wsgi.conf
@@ -4,6 +4,9 @@
{%- else %}
{%- set root = '/srv/static/sites/'+site.name %}
{%- endif %}
+
+Listen {{ site.host.address }}:{{ site.host.port }}
+
<VirtualHost {{ site.host.address }}:{{ site.host.port }}>
{%- include "apache/files/_name.conf" %}
{%- include "apache/files/_wsgi.conf" %}
diff --git a/apache/map.jinja b/apache/map.jinja
index 9a871cc..5fbd71b 100644
--- a/apache/map.jinja
+++ b/apache/map.jinja
@@ -99,9 +99,13 @@
{%- set listen_ports = {} %}
{%- if server.site is defined %}
{%- for site_name, site in server.site.iteritems() %}
-
+{# TODO: move away from managing listen in ports.conf, instead add this directive #}
+{# to specific service config. Currently it conflits with horizon formula, that manage #}
+{# port.conf by theirown, it leads to races when applying horizon/apache states. #}
+{%- if site.get('type', '') != 'wsgi' %}
{%- if site.host.get('port', 80) %}
-{%- set dummy=listen_ports.update({site.host.get('port', 80): None}) %}
+{%- do listen_ports.update({site.host.get('port', 80): None}) %}
+{%- endif %}
{%- endif %}
{%- endfor %}