Merge "Helpdesk frontend related fixes and general cleanup"
diff --git a/horizon/files/local_settings/helpdesk_settings.py b/horizon/files/local_settings/helpdesk_settings.py
index 539a123..432c0d4 100644
--- a/horizon/files/local_settings/helpdesk_settings.py
+++ b/horizon/files/local_settings/helpdesk_settings.py
@@ -3,12 +3,12 @@
 from openstack_dashboard import exceptions
 
 {%- from "horizon/map.jinja" import server with context %}
+
+{%- if server.app is defined %}
 {%- set app = salt['pillar.get']('horizon:server:app:'+app_name) %}
-
-{% include "horizon/files/horizon_settings/_local_settings.py" %}
-{% include "horizon/files/horizon_settings/_horizon_settings.py" %}
-{% include "horizon/files/horizon_settings/_keystone_settings.py" %}
-
+{%- else %}
+{%- set app = salt['pillar.get']('horizon:server') %}
+{%- endif %}
 
 # OpenStack Dashboard configuration.
 HORIZON_CONFIG = {
@@ -30,15 +30,19 @@
 
 SESSION_TIMEOUT = 3600 * 24
 
+{%- if app.theme is defined or app.plugin.horizon_theme is defined %}
+{%- if app.theme is defined %}
+CUSTOM_THEME_PATH = 'dashboards/theme/static/themes/{{ app.theme }}'
+{%- elif app.plugin.horizon_theme.theme_name is defined %}
+# Enable custom theme if it is present.
+try:
+  from openstack_dashboard.enabled._99_horizon_theme import CUSTOM_THEME_PATH
+except ImportError:
+  pass
+{%- endif %}
+{%- endif %}
+
 INSTALLED_APPS = (
-    {%- for plugin_name, plugin in app.plugin.iteritems() %}
-    {%- if not plugin_name == 'horizon_theme' %}
-    '{{ plugin.app }}',
-    {%- endif %}
-    {%- endfor %}
-    'helpdesk_auth',
-    'horizon_contrib',
-    'redactor',
     'openstack_dashboard',
     'django.contrib.contenttypes',
     'django.contrib.auth',
@@ -58,6 +62,14 @@
 
 ROOT_URLCONF = 'helpdesk_dashboard.url_overrides'
 
+{% include "horizon/files/horizon_settings/_keystone_settings.py" %}
+{% include "horizon/files/horizon_settings/_local_settings.py" %}
+
 AUTHENTICATION_BACKENDS = ('helpdesk_auth.backend.HelpdeskBackend',)
 
 AUTHENTICATION_URLS = ['helpdesk_auth.urls']
+
+API_RESULT_PAGE_SIZE = 25
+
+{% include "horizon/files/horizon_settings/_horizon_settings.py" %}
+
diff --git a/horizon/map.jinja b/horizon/map.jinja
index 4e509a9..e7593f8 100644
--- a/horizon/map.jinja
+++ b/horizon/map.jinja
@@ -1,6 +1,6 @@
 {% set server = salt['grains.filter_by']({
     'Debian': {
-        'pkgs': ['openstack-dashboard', 'python-lesscpy', 'python-memcache'],
+        'pkgs': ['apache2', 'openstack-dashboard', 'python-lesscpy', 'python-memcache'],
         'pkgs_multi': ['python-memcache', 'python-psycopg2', 'python-imaging',
             'python-docutils', 'python-simplejson', 'build-essential',
             'libxslt1-dev', 'libxml2-dev', 'libffi-dev', 'libssl-dev',
@@ -16,7 +16,7 @@
         'cache': {'host': '127.0.0.1', 'port': 11211}
     },
     'RedHat': {
-        'pkgs': ['openstack-dashboard', 'python-lesscpy', 'python-memcached'],
+        'pkgs': ['httpd', 'openstack-dashboard', 'python-lesscpy', 'python-memcached'],
         'pkgs_multi': ['python-memcached', 'python-psycopg2', 'python-pillow',
             'python-docutils', 'python-simplejson', 'libxslt-devel', 'gcc',
             'libxml2-devel', 'libffi-devel', 'openssl-devel',
diff --git a/horizon/server/service.sls b/horizon/server/service.sls
index 30c2048..20e121a 100644
--- a/horizon/server/service.sls
+++ b/horizon/server/service.sls
@@ -5,14 +5,6 @@
   pkg.installed:
   - names: {{ server.pkgs }}
 
-{%- if grains.os == "Ubuntu" %}
-
-horizon_ubuntu_theme_absent:
-  pkg.purged:
-  - name: openstack-dashboard-ubuntu-theme
-
-{%- endif %}
-
 horizon_config:
   file.managed:
   - name: {{ server.config }}
@@ -23,10 +15,6 @@
   - group: root
   - require:
     - pkg: horizon_packages
-    {%- if grains.os == "Ubuntu" %}
-    - pkg: horizon_ubuntu_theme_absent
-    {%- endif %}
-
 
 horizon_apache_port_config:
   file.managed:
@@ -52,6 +40,14 @@
   - require:
     - pkg: horizon_packages
 
+/etc/apache2/conf-enabled/openstack-dashboard.conf:
+  file.symlink:
+    - target: /etc/apache2/conf-available/openstack-dashboard.conf
+    
+apache_enable_wsgi:
+  apache_module.enable:
+    - name: wsgi
+
 horizon_services:
   service.running:
   - name: {{ server.service }}
@@ -77,28 +73,4 @@
     - require:
       - file: horizon_log_dir
 
-{#
-{%- if server.get('api_versions', {}).identity is defined %}
-
-horizon_keystone_policy:
-  file.managed:
-  - name: /usr/share/openstack-dashboard/openstack_dashboard/conf/keystone_policy.json
-  {%- if server.get('api_versions', {}).identity == '3' %}
-  - source: salt://horizon/files/policy/{{ server.version }}-keystone-v3.json
-  {%- else %}
-  - source: salt://horizon/files/policy/{{ server.version }}-keystone-v2.json
-  {%- endif %}
-
-{%- endif %}
-
-{%- if server.logging is defined %}
-
-# TODO: package this
-raven:
-  pip.installed:
-    - name: raven >= 4
-
-{%- endif %}
-#}
-
 {%- endif %}