Merge "Revert "Adds Listen directive to openstack-dashboard vhost""
diff --git a/horizon/files/openstack-dashboard.conf.Debian b/horizon/files/openstack-dashboard.conf.Debian
index 362bd4a..224dccb 100644
--- a/horizon/files/openstack-dashboard.conf.Debian
+++ b/horizon/files/openstack-dashboard.conf.Debian
@@ -1,12 +1,6 @@
{%- from "horizon/map.jinja" import server with context %}
-{%- set bind_port = server.get('bind',{}).get('port', 80) %}
-{%- set bind_host_port = server.get('bind', {}).get('address', '0.0.0.0') ~ ":" ~ bind_port %}
-{#- Apache listens on 80 and 443 by default in ports.conf, can't duplicate Listen declaration #}
-{%- if bind_port not in [80, 443] %}
- Listen {{ bind_host_port }}
-{%- endif %}
-<VirtualHost {{ bind_host_port }}>
+<VirtualHost {{ server.get('bind', {}).get('address', '0.0.0.0') }}:{{ server.get('bind', {}).get('port', 80) }}>
ServerName {{ server.get('host', {}).get('name', 'openstack-dashboard') }}
WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
diff --git a/horizon/files/ports.conf b/horizon/files/ports.conf
new file mode 100644
index 0000000..3b7254e
--- /dev/null
+++ b/horizon/files/ports.conf
@@ -0,0 +1,16 @@
+{%- from "horizon/map.jinja" import server with context %}
+# If you just change the port or add more ports here, you will likely also
+# have to change the VirtualHost statement in
+# /etc/apache2/sites-enabled/000-default.conf
+
+Listen {{ server.bind.address }}:{{ server.bind.port }}
+
+<IfModule ssl_module>
+ Listen {{ server.bind.address }}:443
+</IfModule>
+
+<IfModule mod_gnutls.c>
+ Listen {{ server.bind.address }}:443
+</IfModule>
+
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
diff --git a/horizon/map.jinja b/horizon/map.jinja
index b5e5b07..7fec03e 100644
--- a/horizon/map.jinja
+++ b/horizon/map.jinja
@@ -19,6 +19,8 @@
'apache_log_format': '%h %t %m \\"%U%q\\" %H %>s %O %D \\"%{Referer}i\\" \\"%{User-Agent}i\\"',
'certs_dir': '/etc/ssl/certs',
'private_dir': '/etc/ssl/private',
+ 'port_config_file': '/etc/apache2/ports.conf',
+ 'port_config_template': 'salt://horizon/files/ports.conf',
'cache': {'host': '127.0.0.1', 'port': 11211}
},
'RedHat': {
diff --git a/horizon/server/service.sls b/horizon/server/service.sls
index fa0ad5e..e7fd51c 100644
--- a/horizon/server/service.sls
+++ b/horizon/server/service.sls
@@ -58,6 +58,17 @@
{%- endfor %}
+horizon_apache_port_config:
+ file.managed:
+ - name: {{ server.port_config_file }}
+ - source: {{ server.port_config_template }}
+ - template: jinja
+ - mode: 644
+ - user: root
+ - group: root
+ - require:
+ - pkg: horizon_packages
+
horizon_apache_config:
file.managed:
- name: {{ server.apache_config }}
@@ -90,6 +101,7 @@
- file: horizon_config
- file: horizon_apache_config
- file: horizon_log_file
+ - file: horizon_apache_port_config
horizon_log_dir:
file.directory:
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index 952413f..7240cdd 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -13,7 +13,7 @@
cache:
engine: memcached
prefix: 'CACHE_HORIZON'
- members:
+ members:
- host: 127.0.0.1
port: 11211
- host: 127.0.0.1