blob: 6fe15a3c8112d5788359a015b345b2141a1e1588 [file] [log] [blame]
Denis Egorenkoa45a0a02013-10-01 16:03:39 +00001# lib/savanna-dashboard
2
3# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01004#
5# - ``functions`` file
6# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
7# - ``SERVICE_HOST``
Denis Egorenkoa45a0a02013-10-01 16:03:39 +00008
9# ``stack.sh`` calls the entry points in this order:
10#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010011# - install_savanna_dashboard
12# - configure_savanna_dashboard
13# - cleanup_savanna_dashboard
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000014
15# Save trace setting
16XTRACE=$(set +o | grep xtrace)
17set +o xtrace
18
19source $TOP_DIR/lib/horizon
20
21# Defaults
22# --------
23
24# Set up default repos
25SAVANNA_DASHBOARD_REPO=${SAVANNA_DASHBOARD_REPO:-${GIT_BASE}/openstack/savanna-dashboard.git}
26SAVANNA_DASHBOARD_BRANCH=${SAVANNA_DASHBOARD_BRANCH:-master}
27
28SAVANNA_PYTHONCLIENT_REPO=${SAVANNA_PYTHONCLIENT_REPO:-${GIT_BASE}/openstack/python-savannaclient.git}
29SAVANNA_PYTHONCLIENT_BRANCH=${SAVANNA_PYTHONCLIENT_BRANCH:-master}
30
31# Set up default directories
Sergey Lukjanov78585102013-12-04 01:41:11 +040032SAVANNA_DASHBOARD_DIR=$DEST/savanna-dashboard
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000033SAVANNA_PYTHONCLIENT_DIR=$DEST/python-savannaclient
34
35# Functions
36# ---------
37
Ian Wienandaee18c72014-02-21 15:35:08 +110038function configure_savanna_dashboard {
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000039
Sergey Lukjanov35117362014-02-17 18:38:07 +040040 echo -e "AUTO_ASSIGNMENT_ENABLED = False" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
41 echo -e "HORIZON_CONFIG['dashboards'] += ('savanna',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
42 echo -e "INSTALLED_APPS += ('savannadashboard',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000043
44 if is_service_enabled neutron; then
45 echo -e "SAVANNA_USE_NEUTRON = True" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
46 fi
47}
48
49# install_savanna_dashboard() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110050function install_savanna_dashboard {
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000051 install_python_savannaclient
52 git_clone $SAVANNA_DASHBOARD_REPO $SAVANNA_DASHBOARD_DIR $SAVANNA_DASHBOARD_BRANCH
53 setup_develop $SAVANNA_DASHBOARD_DIR
54}
55
Ian Wienandaee18c72014-02-21 15:35:08 +110056function install_python_savannaclient {
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000057 git_clone $SAVANNA_PYTHONCLIENT_REPO $SAVANNA_PYTHONCLIENT_DIR $SAVANNA_PYTHONCLIENT_BRANCH
58 setup_develop $SAVANNA_PYTHONCLIENT_DIR
59}
60
61# Cleanup file settings.py from Savanna
Ian Wienandaee18c72014-02-21 15:35:08 +110062function cleanup_savanna_dashboard {
Denis Egorenkoa45a0a02013-10-01 16:03:39 +000063 sed -i '/savanna/d' $HORIZON_DIR/openstack_dashboard/settings.py
64}
65
66# Restore xtrace
67$XTRACE
68
69# Local variables:
70# mode: shell-script
71# End:
72