/
extend_start.sh
375 lines (323 loc) · 14.1 KB
/
extend_start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
#!/bin/bash
set -o errexit
FORCE_GENERATE="${FORCE_GENERATE}"
HASH_PATH=/var/lib/kolla/.settings.md5sum.txt
if [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then
if [[ ${KOLLA_BASE_DISTRO} == "debian" ]] || [[ ${KOLLA_BASE_DISTRO} == "ubuntu" ]]; then
SITE_PACKAGES="/usr/lib/python3/dist-packages"
else
SITE_PACKAGES="/usr/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
fi
elif [[ ${KOLLA_INSTALL_TYPE} == "source" ]]; then
SITE_PACKAGES="/var/lib/kolla/venv/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
fi
if [[ -f "/var/lib/kolla/venv/bin/python" ]]; then
MANAGE_PY="/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py"
else
MANAGE_PY="/usr/bin/python${KOLLA_DISTRO_PYTHON_VERSION} /usr/bin/manage.py"
fi
if [[ ${KOLLA_INSTALL_TYPE} == "source" ]] && [[ ! -f ${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py ]]; then
ln -s /etc/openstack-dashboard/local_settings \
${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py
elif [[ ${KOLLA_BASE_DISTRO} == "debian" ]] && [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then
rm -f ${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py
ln -s /etc/openstack-dashboard/local_settings \
${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py
fi
if [[ -f /etc/openstack-dashboard/custom_local_settings ]]; then
CUSTOM_SETTINGS_FILE="${SITE_PACKAGES}/openstack_dashboard/local/custom_local_settings.py"
if [[ ${KOLLA_INSTALL_TYPE} == "binary" ]] && [[ "${KOLLA_BASE_DISTRO}" =~ ubuntu ]]; then
CUSTOM_SETTINGS_FILE="/usr/share/openstack-dashboard/openstack_dashboard/local/custom_local_settings.py"
fi
if [[ ! -L ${CUSTOM_SETTINGS_FILE} ]]; then
ln -s /etc/openstack-dashboard/custom_local_settings ${CUSTOM_SETTINGS_FILE}
fi
fi
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
$MANAGE_PY migrate --noinput
exit 0
fi
function config_dashboard {
ENABLE=$1
SRC=$2
DEST=$3
if [[ ! -f ${SRC} ]]; then
echo "WARNING: ${SRC} is required"
elif [[ "${ENABLE}" == "yes" ]] && [[ ! -f "${DEST}" ]]; then
cp -a "${SRC}" "${DEST}"
FORCE_GENERATE="yes"
elif [[ "${ENABLE}" != "yes" ]] && [[ -f "${DEST}" ]]; then
# remove pyc pyo files too
rm -f "${DEST}" "${DEST}c" "${DEST}o"
FORCE_GENERATE="yes"
fi
}
function config_blazar_dashboard {
for file in ${SITE_PACKAGES}/blazar_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_BLAZAR}" \
"${SITE_PACKAGES}/blazar_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_cloudkitty_dashboard {
for file in ${SITE_PACKAGES}/cloudkittydashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_CLOUDKITTY}" \
"${SITE_PACKAGES}/cloudkittydashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_designate_dashboard {
for file in ${SITE_PACKAGES}/designatedashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_DESIGNATE}" \
"${SITE_PACKAGES}/designatedashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_freezer_ui {
for file in ${SITE_PACKAGES}/disaster_recovery/enabled/_*[^__].py; do
config_dashboard "${ENABLE_FREEZER}" \
"${SITE_PACKAGES}/disaster_recovery/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_heat_dashboard {
for file in ${SITE_PACKAGES}/heat_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_HEAT}" \
"${SITE_PACKAGES}/heat_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
config_dashboard "${ENABLE_HEAT}" \
"${SITE_PACKAGES}/heat_dashboard/conf/heat_policy.json" \
"/etc/openstack-dashboard/heat_policy.json"
}
function config_ironic_dashboard {
for file in ${SITE_PACKAGES}/ironic_ui/enabled/_*[^__].py; do
config_dashboard "${ENABLE_IRONIC}" \
"${SITE_PACKAGES}/ironic_ui/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_karbor_dashboard {
for file in ${SITE_PACKAGES}/karbor_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_KARBOR}" \
"${SITE_PACKAGES}/karbor_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_magnum_dashboard {
for file in ${SITE_PACKAGES}/magnum_ui/enabled/_*[^__].py; do
config_dashboard "${ENABLE_MAGNUM}" \
"${SITE_PACKAGES}/magnum_ui/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_manila_ui {
for file in ${SITE_PACKAGES}/manila_ui/local/enabled/_*[^__].py; do
config_dashboard "${ENABLE_MANILA}" \
"${SITE_PACKAGES}/manila_ui/local/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_masakari_dashboard {
for file in ${SITE_PACKAGES}/masakaridashboard/local/enabled/_*[^__].py; do
config_dashboard "${ENABLE_MASAKARI}" \
"${SITE_PACKAGES}/masakaridashboard/local/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
config_dashboard "${ENABLE_MASAKARI}"\
"${SITE_PACKAGES}/masakaridashboard/conf/masakari_policy.json" \
"${SITE_PACKAGES}/openstack_dashboard/conf/masakari_policy.json"
config_dashboard "${ENABLE_MASAKARI}"\
"${SITE_PACKAGES}/masakaridashboard/local/local_settings.d/_50_masakari.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/local_settings.d/_50_masakari.py"
}
function config_monasca_ui {
config_dashboard "${ENABLE_MONASCA}" \
"${SITE_PACKAGES}/monitoring/enabled/_50_admin_add_monitoring_panel.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/_50_admin_add_monitoring_panel.py"
config_dashboard "${ENABLE_MONASCA}" \
"${SITE_PACKAGES}/monitoring/conf/monitoring_policy.json" \
"${SITE_PACKAGES}/openstack_dashboard/conf/monitoring_policy.json"
}
function config_murano_dashboard {
for file in ${SITE_PACKAGES}/muranodashboard/local/enabled/_*[^__].py; do
config_dashboard "${ENABLE_MURANO}" \
"${SITE_PACKAGES}/muranodashboard/local/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
config_dashboard "${ENABLE_MURANO}"\
"${SITE_PACKAGES}/muranodashboard/conf/murano_policy.json" \
"/etc/openstack-dashboard/murano_policy.json"
config_dashboard "${ENABLE_MURANO}"\
"${SITE_PACKAGES}/muranodashboard/local/local_settings.d/_50_murano.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/local_settings.d/_50_murano.py"
}
function config_mistral_dashboard {
config_dashboard "${ENABLE_MISTRAL}" \
"${SITE_PACKAGES}/mistraldashboard/enabled/_50_mistral.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/_50_mistral.py"
}
function config_neutron_vpnaas_dashboard {
config_dashboard "${ENABLE_NEUTRON_VPNAAS}" \
"${SITE_PACKAGES}/neutron_vpnaas_dashboard/enabled/_7100_project_vpn_panel.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/_7100_project_vpn_panel.py"
}
function config_octavia_dashboard {
config_dashboard "${ENABLE_OCTAVIA}" \
"${SITE_PACKAGES}/octavia_dashboard/enabled/_1482_project_load_balancer_panel.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/_1482_project_load_balancer_panel.py"
}
function config_qinling_dashboard {
for file in ${SITE_PACKAGES}/qinling_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_QINLING}" \
"${SITE_PACKAGES}/qinling_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_sahara_dashboard {
for file in ${SITE_PACKAGES}/sahara_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_SAHARA}" \
"${SITE_PACKAGES}/sahara_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_searchlight_ui {
for file in ${SITE_PACKAGES}/searchlight_ui/enabled/_*[^__].py; do
config_dashboard "${ENABLE_SEARCHLIGHT}" \
"${SITE_PACKAGES}/searchlight_ui/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
config_dashboard "${ENABLE_SEARCHLIGHT}" \
"${SITE_PACKAGES}/searchlight_ui/local_settings.d/_1001_search_settings.py" \
"${SITE_PACKAGES}/openstack_dashboard/local/local_settings.d/_1001_search_settings.py"
config_dashboard "${ENABLE_SEARCHLIGHT}" \
"${SITE_PACKAGES}/searchlight_ui/conf/searchlight_policy.json" \
"/etc/openstack-dashboard/searchlight_policy.json"
}
function config_senlin_dashboard {
for file in ${SITE_PACKAGES}/senlin_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_SENLIN}" \
"${SITE_PACKAGES}/senlin_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
config_dashboard "${ENABLE_SENLIN}" \
"${SITE_PACKAGES}/senlin_dashboard/conf/senlin_policy.json" \
"/etc/openstack-dashboard/senlin_policy.json"
}
function config_solum_dashboard {
for file in ${SITE_PACKAGES}/solumdashboard/local/enabled/_*[^__].py; do
config_dashboard "${ENABLE_SOLUM}" \
"${SITE_PACKAGES}/solumdashboard/local/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_tacker_dashboard {
for file in ${SITE_PACKAGES}/tacker_horizon/enabled/_*[^__].py; do
config_dashboard "${ENABLE_TACKER}" \
"${SITE_PACKAGES}/tacker_horizon/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_trove_dashboard {
for file in ${SITE_PACKAGES}/trove_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_TROVE}" \
"${SITE_PACKAGES}/trove_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_vitrage_dashboard {
for file in ${SITE_PACKAGES}/vitrage_dashboard/enabled/_*[^__].py; do
config_dashboard "${ENABLE_VITRAGE}" \
"${SITE_PACKAGES}/vitrage_dashboard/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_watcher_dashboard {
for file in ${SITE_PACKAGES}/watcher_dashboard/local/enabled/_*[^__].py; do
config_dashboard "${ENABLE_WATCHER}" \
"${SITE_PACKAGES}/watcher_dashboard/local/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
config_dashboard "${ENABLE_WATCHER}" \
"${SITE_PACKAGES}/watcher_dashboard/conf/watcher_policy.json" \
"/etc/openstack-dashboard/watcher_policy.json"
}
function config_zaqar_dashboard {
for file in ${SITE_PACKAGES}/zaqar_ui/enabled/_*[^__].py; do
config_dashboard "${ENABLE_ZAQAR}" \
"${SITE_PACKAGES}/zaqar_ui/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
function config_zun_dashboard {
for file in ${SITE_PACKAGES}/zun_ui/enabled/_*[^__].py; do
config_dashboard "${ENABLE_ZUN}" \
"${SITE_PACKAGES}/zun_ui/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
}
# Regenerate the compressed javascript and css if any configuration files have
# changed. Use a static modification date when generating the tarball
# so that we only trigger on content changes.
function settings_bundle {
tar -cf- --mtime=1970-01-01 \
/etc/openstack-dashboard/local_settings \
/etc/openstack-dashboard/custom_local_settings \
/etc/openstack-dashboard/local_settings.d 2> /dev/null
}
function settings_changed {
changed=1
if [[ ! -f $HASH_PATH ]] || ! settings_bundle | md5sum -c --status $HASH_PATH || [[ $FORCE_GENERATE == yes ]]; then
changed=0
fi
return ${changed}
}
config_blazar_dashboard
config_cloudkitty_dashboard
config_designate_dashboard
config_freezer_ui
config_heat_dashboard
config_ironic_dashboard
config_karbor_dashboard
config_magnum_dashboard
config_manila_ui
config_masakari_dashboard
config_mistral_dashboard
config_monasca_ui
config_murano_dashboard
config_neutron_vpnaas_dashboard
config_octavia_dashboard
config_qinling_dashboard
config_sahara_dashboard
config_searchlight_ui
config_senlin_dashboard
config_solum_dashboard
config_tacker_dashboard
config_trove_dashboard
config_vitrage_dashboard
config_watcher_dashboard
config_zaqar_dashboard
config_zun_dashboard
if settings_changed; then
${MANAGE_PY} collectstatic --noinput --clear
${MANAGE_PY} compress --force
settings_bundle | md5sum > $HASH_PATH
fi
# NOTE(sbezverk) since Horizon is now storing logs in its own location, /var/log/horizon
# needs to be created if it does not exist
if [[ ! -d "/var/log/kolla/horizon" ]]; then
mkdir -p /var/log/kolla/horizon
fi
if [[ $(stat -c %a /var/log/kolla/horizon) != "755" ]]; then
chmod 755 /var/log/kolla/horizon
fi
if [[ -f ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store ]] && [[ $(stat -c %U ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store) != "horizon" ]]; then
chown horizon ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store
fi
. /usr/local/bin/kolla_httpd_setup
if [[ "${KOLLA_BASE_DISTRO}" == "debian" ]] && [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then
APACHE_RUN_GROUP=horizon
APACHE_RUN_USER=horizon
fi