Browse code

Move horizon config and start to appropriate phase in stack.sh

Previously horizon configuration and start are done too early
and as a result horizon init and start need to be run twice
after horizon plugins are enabled.
- horizon config was done before "run_phase stack install"
- horizon init and start were done before "run_phase stack post-config"

This commit rearrange horizon setup to the appropriate phases
defined in the devstack plugin interface.

- Configuration of horizon settings is moved to configure_horizon.
- horizon config is now called between run_phase stack install
and post-config.
- horizon init and start are now called between run_phase stack
post-config and extra.

Change-Id: I8bf2ceaf7734c4f7cec68bc05d7cdbae81ef311e

Akihiro Motoki authored on 2015/12/15 16:44:41
Showing 2 changed files
... ...
@@ -83,10 +83,7 @@ function configure_horizon {
83 83
     # Message catalog compilation is handled by Django admin script,
84 84
     # so compiling them after the installation avoids Django installation twice.
85 85
     (cd $HORIZON_DIR; ./run_tests.sh -N --compilemessages)
86
-}
87 86
 
88
-# init_horizon() - Initialize databases, etc.
89
-function init_horizon {
90 87
     # ``local_settings.py`` is used to override horizon default settings.
91 88
     local local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
92 89
     cp $HORIZON_SETTINGS $local_settings
... ...
@@ -113,6 +110,7 @@ function init_horizon {
113 113
     horizon_conf=$(apache_site_config_for horizon)
114 114
 
115 115
     # Configure apache to run horizon
116
+    # Set up the django horizon application to serve via apache/wsgi
116 117
     sudo sh -c "sed -e \"
117 118
         s,%USER%,$APACHE_USER,g;
118 119
         s,%GROUP%,$APACHE_GROUP,g;
... ...
@@ -133,7 +131,10 @@ function init_horizon {
133 133
         exit_distro_not_supported "horizon apache configuration"
134 134
     fi
135 135
     enable_apache_site horizon
136
+}
136 137
 
138
+# init_horizon() - Initialize databases, etc.
139
+function init_horizon {
137 140
     # Remove old log files that could mess with how DevStack detects whether Horizon
138 141
     # has been successfully started (see start_horizon() and functions::screen_it())
139 142
     # and run_process
... ...
@@ -147,6 +148,7 @@ function init_horizon {
147 147
         django_admin=django-admin.py
148 148
     fi
149 149
 
150
+    # These need to be run after horizon plugins are configured.
150 151
     DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin collectstatic --noinput
151 152
     DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin compress --force
152 153
 
... ...
@@ -840,7 +840,6 @@ if is_service_enabled horizon; then
840 840
     install_django_openstack_auth
841 841
     # dashboard
842 842
     stack_install_service horizon
843
-    configure_horizon
844 843
 fi
845 844
 
846 845
 if is_service_enabled heat; then
... ...
@@ -1060,12 +1059,9 @@ write_clouds_yaml
1060 1060
 # Horizon
1061 1061
 # -------
1062 1062
 
1063
-# Set up the django horizon application to serve via apache/wsgi
1064
-
1065 1063
 if is_service_enabled horizon; then
1066
-    echo_summary "Configuring and starting Horizon"
1067
-    init_horizon
1068
-    start_horizon
1064
+    echo_summary "Configuring Horizon"
1065
+    configure_horizon
1069 1066
 fi
1070 1067
 
1071 1068
 
... ...
@@ -1290,6 +1286,12 @@ if is_service_enabled heat; then
1290 1290
     fi
1291 1291
 fi
1292 1292
 
1293
+if is_service_enabled horizon; then
1294
+    echo_summary "Starting Horizon"
1295
+    init_horizon
1296
+    start_horizon
1297
+fi
1298
+
1293 1299
 
1294 1300
 # Create account rc files
1295 1301
 # =======================