Fix local_settings.py when app.plugin is not set

Without this patch the following error can be seen:
```
          ID: horizon_config
    Function: file.managed
        Name: /etc/openstack-dashboard/local_settings.py
      Result: False
     Comment: Unable to manage file: Jinja variable 'dict object' has no attribute 'plugin'
     Started: 20:38:48.391267
    Duration: 45.732 ms
     Changes:
```

This patch fixes it by first checking whether app.plugin is defined.

Change-Id: Id6f281f6593a0d96210ffc44b9ba7836d5dca9d2
diff --git a/horizon/files/local_settings/kilo_settings.py b/horizon/files/local_settings/kilo_settings.py
index 3c59278..0f14217 100644
--- a/horizon/files/local_settings/kilo_settings.py
+++ b/horizon/files/local_settings/kilo_settings.py
@@ -31,7 +31,7 @@
 
 {%- if app.theme is defined %}
 CUSTOM_THEME_PATH = 'static/themes/{{ app.theme }}'
-{%- elif app.plugin.horizon_theme.theme_name is defined %}
+{%- elif app.plugin is defined and app.plugin.horizon_theme.theme_name is defined %}
 CUSTOM_THEME_PATH = 'static/themes/{{ app.plugin.horizon_theme.theme_name }}'
 {%- endif %}
 
diff --git a/horizon/files/local_settings/liberty_settings.py b/horizon/files/local_settings/liberty_settings.py
index 47e3587..22e3a4d 100644
--- a/horizon/files/local_settings/liberty_settings.py
+++ b/horizon/files/local_settings/liberty_settings.py
@@ -28,7 +28,7 @@
     'js_spec_files': [],
     'password_autocomplete': 'on'
 }
-{%- if app.theme is defined or app.plugin.horizon_theme is defined %}
+{%- if app.theme is defined or (app.plugin is defined and app.plugin.horizon_theme is defined) %}
 {%- if app.theme is defined %}
 CUSTOM_THEME_PATH = 'themes/{{ app.theme }}'
 {%- elif app.plugin.horizon_theme.theme_name is defined %}
diff --git a/horizon/files/local_settings/mitaka_settings.py b/horizon/files/local_settings/mitaka_settings.py
index 47e3587..22e3a4d 100644
--- a/horizon/files/local_settings/mitaka_settings.py
+++ b/horizon/files/local_settings/mitaka_settings.py
@@ -28,7 +28,7 @@
     'js_spec_files': [],
     'password_autocomplete': 'on'
 }
-{%- if app.theme is defined or app.plugin.horizon_theme is defined %}
+{%- if app.theme is defined or (app.plugin is defined and app.plugin.horizon_theme is defined) %}
 {%- if app.theme is defined %}
 CUSTOM_THEME_PATH = 'themes/{{ app.theme }}'
 {%- elif app.plugin.horizon_theme.theme_name is defined %}