"Fossies" - the Fresh Open Source Software Archive

Member "monasca-api-4.0.0/devstack/lib/ui.sh" (13 May 2020, 3562 Bytes) of package /linux/misc/openstack/monasca-api-4.0.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 latest 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         cp $MONASCA_UI_DIR/monitoring/config/local_settings.py \
   38             $HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_monasca_ui_settings.py
   39 
   40         local localSettings=$HORIZON_DIR/openstack_dashboard/local/local_settings.d/_50_monasca_ui_settings.py
   41 
   42         sed -e "
   43             s#getattr(settings, 'GRAFANA_URL', None)#{'RegionOne': \"http:\/\/${SERVICE_HOST}:3000\", }#g;
   44         " -i ${localSettings}
   45 
   46         if is_service_enabled horizon && is_service_enabled kibana && is_service_enabled monasca-log; then
   47             echo_summary "Configure Horizon with Kibana access"
   48             sudo sed -e "
   49                 s|KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://192.168.10.6:5601/')|KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://${KIBANA_SERVICE_HOST}:${KIBANA_SERVICE_PORT}/')|g;
   50             " -i ${localSettings}
   51 
   52             sudo sed -e "
   53                 s|'ENABLE_LOG_MANAGEMENT_BUTTON', False|'ENABLE_LOG_MANAGEMENT_BUTTON', True|g;
   54             " -i ${localSettings}
   55         fi
   56         if python3_enabled; then
   57             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python3 "${MONASCA_BASE}"/horizon/manage.py collectstatic --noinput
   58             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python3 "${MONASCA_BASE}"/horizon/manage.py compress --force
   59         else
   60             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python "${MONASCA_BASE}"/horizon/manage.py collectstatic --noinput
   61             DJANGO_SETTINGS_MODULE=openstack_dashboard.settings python "${MONASCA_BASE}"/horizon/manage.py compress --force
   62         fi
   63         restart_service apache2 || true
   64     fi
   65 }
   66 
   67 function install_ui {
   68     if is_ui_enabled; then
   69         git_clone $MONASCA_UI_REPO $MONASCA_UI_DIR $MONASCA_UI_BRANCH
   70         git_clone $MONASCA_CLIENT_REPO $MONASCA_CLIENT_DIR $MONASCA_CLIENT_BRANCH
   71         if python3_enabled; then
   72             enable_python3_package monasca-ui
   73         fi
   74 
   75         setup_develop $MONASCA_UI_DIR
   76         setup_dev_lib "python-monascaclient"
   77 
   78     fi
   79 }
   80 
   81 function _link_ui_files {
   82     ln -f "${MONASCA_UI_DIR}/monitoring/enabled/_50_admin_add_monitoring_panel.py" \
   83         "${HORIZON_DIR}/openstack_dashboard/local/enabled/_50_admin_add_monitoring_panel.py"
   84     ln -f "${MONASCA_UI_DIR}/monitoring/conf/monitoring_policy.json" \
   85         "${HORIZON_DIR}/openstack_dashboard/conf/monitoring_policy.json"
   86     ln -sfF "${MONASCA_UI_DIR}"/monitoring "${HORIZON_DIR}/monitoring"
   87 }
   88 
   89 $_XTRACE_DASHBOARD