Improving find static robustness
The find static utility method assumes a filesystem layout that may or may not be present on certain distros. This fixes this by using the python install path. Closes-bug: #1494171 Change-Id: Iab72b4b872849d2496cc634677e5bfe478aa03be
This commit is contained in:
parent
3fd5aa17c3
commit
515374d431
@ -325,7 +325,7 @@ if os.path.exists(os.path.join(CUSTOM_THEME, 'img')):
|
||||
|
||||
# populate HORIZON_CONFIG with auto-discovered JavaScript sources, mock files,
|
||||
# specs files and external templates.
|
||||
find_static_files(ROOT_PATH, HORIZON_CONFIG)
|
||||
find_static_files(HORIZON_CONFIG)
|
||||
|
||||
# Load the pluggable dashboard settings
|
||||
import openstack_dashboard.enabled
|
||||
|
@ -139,12 +139,17 @@ def get_staticfiles_dirs(webroot='/'):
|
||||
return STATICFILES_DIRS
|
||||
|
||||
|
||||
def find_static_files(ROOT_PATH, HORIZON_CONFIG):
|
||||
def find_static_files(HORIZON_CONFIG):
|
||||
import horizon
|
||||
import openstack_dashboard
|
||||
os_dashboard_home_dir = openstack_dashboard.__path__[0]
|
||||
horizon_home_dir = horizon.__path__[0]
|
||||
|
||||
# note the path must end in a '/' or the resultant file paths will have a
|
||||
# leading "/"
|
||||
file_discovery.populate_horizon_config(
|
||||
HORIZON_CONFIG,
|
||||
os.path.join(ROOT_PATH, '..', 'horizon', 'static/')
|
||||
os.path.join(horizon_home_dir, 'static/')
|
||||
)
|
||||
|
||||
# filter out non-angular javascript code and lib
|
||||
@ -155,6 +160,6 @@ def find_static_files(ROOT_PATH, HORIZON_CONFIG):
|
||||
# leading "/"
|
||||
file_discovery.populate_horizon_config(
|
||||
HORIZON_CONFIG,
|
||||
os.path.join(ROOT_PATH, 'static/'),
|
||||
os.path.join(os_dashboard_home_dir, 'static/'),
|
||||
sub_path='app/'
|
||||
)
|
||||
|
@ -87,7 +87,7 @@ settings.update_dashboards(
|
||||
)
|
||||
INSTALLED_APPS[0:0] = []
|
||||
|
||||
find_static_files(ROOT_PATH, HORIZON_CONFIG)
|
||||
find_static_files(HORIZON_CONFIG)
|
||||
|
||||
# Set to True to allow users to upload images to glance via Horizon server.
|
||||
# When enabled, a file form field will appear on the create image form.
|
||||
|
Loading…
Reference in New Issue
Block a user