"Fossies" - the Fresh Open Source Software Archive

Member "monasca-api-3.1.0/devstack/lib/ui.sh" (27 Sep 2019, 2736 Bytes) of package /linux/misc/openstack/monasca-api-3.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "ui.sh": 3.1.0_vs_4.0.0.

    1 #!/bin/bash
    2 
    3 # Copyright 2017 FUJITSU LIMITED
    4 #
    5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    6 # not use this file except in compliance with the License. You may obtain
    7 # a copy of the License at
    8 #
    9 #      http://www.apache.org/licenses/LICENSE-2.0
   10 #
   11 # Unless required by applicable law or agreed to in writing, software
   12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   14 # License for the specific language governing permissions and limitations
   15 # under the License.
   16 
   17 _XTRACE_DASHBOARD=$(set +o | grep xtrace)
   18 set +o xtrace
   19 
   20 function is_ui_enabled {
   21     is_service_enabled horizon && return 0
   22     return 1
   23 }
   24 
   25 function clean_ui {
   26     if is_ui_enabled; then
   27         rm -rf "${HORIZON_DIR}/monitoring" \
   28             "${HORIZON_DIR}/openstack_dashboard/local/enabled/_50_admin_add_monitoring_panel.py" \
   29             "${HORIZON_DIR}/openstack_dashboard/conf/monitoring_policy.json"
   30     fi
   31 }
   32 
   33 function configure_ui {
   34     if is_ui_enabled; then
   35         _link_ui_files
   36 
   37         sed -e "
   38             s#getattr(settings, 'GRAFANA_URL', None)#{'RegionOne': \"http:\/\/${SERVICE_HOST}:3000\", }#g;
   39         " -i "${MONASCA_BASE}"/monasca-ui/monitoring/config/local_settings.py
   40         if python3_enabled; then
   41             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python3 "${MONASCA_BASE}"/horizon/manage.py collectstatic --noinput
   42             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python3 "${MONASCA_BASE}"/horizon/manage.py compress --force
   43         else
   44             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python "${MONASCA_BASE}"/horizon/manage.py collectstatic --noinput
   45             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python "${MONASCA_BASE}"/horizon/manage.py compress --force
   46         fi
   47         restart_service apache2 || true
   48     fi
   49 }
   50 
   51 function install_ui {
   52     if is_ui_enabled; then
   53         git_clone $MONASCA_UI_REPO $MONASCA_UI_DIR $MONASCA_UI_BRANCH
   54         git_clone $MONASCA_CLIENT_REPO $MONASCA_CLIENT_DIR $MONASCA_CLIENT_BRANCH
   55         if python3_enabled; then
   56             enable_python3_package monasca-ui
   57         fi
   58 
   59         setup_develop $MONASCA_UI_DIR
   60         setup_dev_lib "python-monascaclient"
   61 
   62     fi
   63 }
   64 
   65 function _link_ui_files {
   66     ln -f "${MONASCA_UI_DIR}/monitoring/enabled/_50_admin_add_monitoring_panel.py" \
   67         "${HORIZON_DIR}/openstack_dashboard/local/enabled/_50_admin_add_monitoring_panel.py"
   68     ln -f "${MONASCA_UI_DIR}/monitoring/conf/monitoring_policy.json" \
   69         "${HORIZON_DIR}/openstack_dashboard/conf/monitoring_policy.json"
   70     ln -sfF "${MONASCA_UI_DIR}"/monitoring "${HORIZON_DIR}/monitoring"
   71 }
   72 
   73 $_XTRACE_DASHBOARD