Integrate fully with new python-monascaclient
* shell commands completition * usage of openstack openrc utility to source environmental variables to use client Extra: * removed cassandra env and replaced it with bash code * reworked creating bash profile * removed devstack/files/env.sh as it is no longer needed and everything is available through profile Depends-On: I579f6bcd5975a32af2a255be41c9b6c4043fa1dc Depends-On: Ifee5b88ccb632222310aafb1081ecb9c9d085150 Depends-On: I01d0f3d9814376f9358feb23494e1ca5231aedac Depends-On: I1712a24739438e2d8331a495f18f357749a633c5 Change-Id: I35f5943ae1eadb10dc416179c575cdad62753b69
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# Type deactivate before you use cqlsh.
|
||||
export CQLSH_NO_BUNDLED=true
|
||||
export CQLSH_HOST=127.0.0.1
|
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Environment variables for use with python-monascaclient running via monasca-vagrant
|
||||
|
||||
. /opt/monasca/bin/activate
|
||||
. /usr/local/share/monasca.bash_completion
|
||||
export OS_USERNAME=mini-mon
|
||||
export OS_PASSWORD=password
|
||||
export OS_USER_DOMAIN_NAME=Default
|
||||
export OS_PROJECT_NAME=mini-mon
|
||||
export OS_PROJECT_DOMAIN_NAME=Default
|
||||
export OS_AUTH_URL=http://127.0.0.1:35357/v3/
|
34
devstack/lib/client.sh
Normal file
34
devstack/lib/client.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2017 FUJITSU LIMITED
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
_XTRACE_MON_CLIENT=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
install_monascaclient() {
|
||||
git_clone $MONASCA_CLIENT_REPO $MONASCA_CLIENT_DIR $MONASCA_CLIENT_BRANCH
|
||||
setup_dev_lib "python-monascaclient"
|
||||
|
||||
# install completion file
|
||||
monasca complete > /tmp/monasca.bash_completion
|
||||
sudo install -D -m 0644 -o $STACK_USER /tmp/monasca.bash_completion $MONASCA_COMPLETION_FILE
|
||||
rm -rf /tmp/monasca.bash_completion
|
||||
}
|
||||
|
||||
clean_monascaclient() {
|
||||
sudo rm -rf $MONASCA_COMPLETION_FILE
|
||||
}
|
||||
|
||||
${_XTRACE_MON_CLIENT}
|
31
devstack/lib/constants.sh
Normal file
31
devstack/lib/constants.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2017 FUJITSU LIMITED
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
_XTRACE_MON_CONST=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
# Location of python-monascaclient completion file
|
||||
MONASCA_COMPLETION_FILE=/etc/bash_completion.d/monasca.bash_completion
|
||||
|
||||
# Location of monasca-profile
|
||||
MONASCA_PROFILE_FILE=/etc/profile.d/monasca.sh
|
||||
|
||||
# monasca_service_type, used in:
|
||||
# keystone endpoint creation
|
||||
# configuration files
|
||||
MONASCA_SERVICE_TYPE=monitoring
|
||||
|
||||
${_XTRACE_MON_CONST}
|
54
devstack/lib/profile.sh
Normal file
54
devstack/lib/profile.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2017 FUJITSU LIMITED
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
_XTRACE_MON_PROFILE=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
function install_monasca_profile {
|
||||
|
||||
echo_summary "Install Monasca Bash Profile"
|
||||
|
||||
touch /tmp/monasca_cli.sh
|
||||
cat > /tmp/monasca_cli.sh << EOF
|
||||
# signalize we're in shape to use monasca here
|
||||
export PS1='[\u@\h \W(monasca)]\$ '
|
||||
# set monasca client bash_completion
|
||||
source ${MONASCA_COMPLETION_FILE}
|
||||
# set OS_* variables
|
||||
source $TOP_DIR/openrc mini-mon mini-mon
|
||||
# override password for mini-mon (guy is not using SERVICE_PASSWORD)
|
||||
export OS_PASSWORD=password
|
||||
EOF
|
||||
|
||||
if [[ "${MONASCA_METRICS_DB,,}" == 'cassandra' ]]; then
|
||||
cat >> /tmp/monasca_cli.sh << EOF
|
||||
# allow to use cassandra cli
|
||||
export CQLSH_NO_BUNDLED=true
|
||||
export CQLSH_HOST=${SERVICE_HOST}
|
||||
EOF
|
||||
fi
|
||||
|
||||
sudo install -D -m 0644 -o ${STACK_USER} \
|
||||
/tmp/monasca_cli.sh ${MONASCA_PROFILE_FILE}
|
||||
rm /tmp/monasca_cli.sh
|
||||
}
|
||||
|
||||
function clean_monasca_profile {
|
||||
echo_summary "Clean Monasca CLI Creds"
|
||||
sudo rm -f ${MONASCA_PROFILE_FILE}
|
||||
}
|
||||
|
||||
${_XTRACE_DASHBOARD}
|
@@ -45,17 +45,14 @@ ERREXIT=$(set +o | grep errexit)
|
||||
set -o errexit
|
||||
|
||||
# source lib/*
|
||||
source ${MONASCA_API_DIR}/devstack/lib/constants.sh
|
||||
source ${MONASCA_API_DIR}/devstack/lib/zookeeper.sh
|
||||
source ${MONASCA_API_DIR}/devstack/lib/ui.sh
|
||||
source ${MONASCA_API_DIR}/devstack/lib/notification.sh
|
||||
source ${MONASCA_API_DIR}/devstack/lib/profile.sh
|
||||
source ${MONASCA_API_DIR}/devstack/lib/client.sh
|
||||
# source lib/*
|
||||
|
||||
# Set default implementations to python
|
||||
export MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-python}
|
||||
export MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-python}
|
||||
|
||||
# Set default persistent layer settings
|
||||
export MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-influxdb}
|
||||
# Make sure we use ORM mapping as default if postgresql is enabled
|
||||
if is_service_enabled mysql; then
|
||||
MONASCA_DATABASE_USE_ORM=${MONASCA_DATABASE_USE_ORM:-false}
|
||||
@@ -81,26 +78,19 @@ else
|
||||
|
||||
fi
|
||||
|
||||
# venv settings
|
||||
# monasca-api settings
|
||||
if [[ ${USE_VENV} = True ]]; then
|
||||
PROJECT_VENV["monasca-api"]=${MONASCA_API_DIR}.venv
|
||||
MONASCA_API_BIN_DIR=${PROJECT_VENV["monasca-api"]}/bin
|
||||
else
|
||||
MONASCA_API_BIN_DIR=$(get_python_exec_prefix)
|
||||
fi
|
||||
|
||||
# monasca-api settings
|
||||
MONASCA_API_BASE_URI=${MONASCA_API_SERVICE_PROTOCOL}://${MONASCA_API_SERVICE_HOST}:${MONASCA_API_SERVICE_PORT}
|
||||
MONASCA_API_URI_V2=${MONASCA_API_BASE_URI}/v2.0
|
||||
|
||||
# Files inside this directory will be visible in gates log
|
||||
MON_API_GATE_CONFIGURATION_DIR=/etc/monasca-api
|
||||
|
||||
# monasca_service_type, used in:
|
||||
# keystone endpoint creation
|
||||
# configuration files
|
||||
MONASCA_SERVICE_TYPE=monitoring
|
||||
|
||||
function pre_install_monasca {
|
||||
echo_summary "Pre-Installing Monasca Components"
|
||||
find_nearest_apache_mirror
|
||||
@@ -146,7 +136,6 @@ function install_monasca {
|
||||
fi
|
||||
|
||||
install_ui
|
||||
install_cli_creds
|
||||
}
|
||||
|
||||
function configure_monasca {
|
||||
@@ -183,10 +172,9 @@ function extra_monasca {
|
||||
echo_summary "Installing additional monasca components"
|
||||
|
||||
create_metric_accounts
|
||||
|
||||
install_keystone_client
|
||||
|
||||
install_monasca_agent
|
||||
install_monascaclient
|
||||
install_monasca_profile
|
||||
|
||||
if is_service_enabled horizon; then
|
||||
install_node_nvm
|
||||
@@ -280,7 +268,8 @@ function clean_monasca {
|
||||
|
||||
clean_schema
|
||||
|
||||
clean_cli_creds
|
||||
clean_monasca_profile
|
||||
clean_monascaclient
|
||||
|
||||
clean_monasca_$MONASCA_METRICS_DB
|
||||
|
||||
@@ -584,42 +573,6 @@ function clean_monasca_cassandra {
|
||||
sudo rm -f /etc/apt/trusted.gpg.d/cassandra.gpg
|
||||
}
|
||||
|
||||
function install_cli_creds {
|
||||
|
||||
echo_summary "Install Monasca CLI Creds"
|
||||
|
||||
if [[ "${MONASCA_METRICS_DB,,}" == 'cassandra' ]]; then
|
||||
|
||||
sudo sh -c "cat ${MONASCA_API_DIR}/devstack/files/env.sh \
|
||||
${MONASCA_API_DIR}/devstack/files/cassandra/env_cassandra.sh \
|
||||
> /etc/profile.d/monasca_cli.sh"
|
||||
|
||||
else
|
||||
|
||||
sudo cp -f "${MONASCA_API_DIR}"/devstack/files/env.sh /etc/profile.d/monasca_cli.sh
|
||||
|
||||
fi
|
||||
|
||||
if [[ ${SERVICE_HOST} ]]; then
|
||||
|
||||
sudo sed -i "s/127\.0\.0\.1/${SERVICE_HOST}/g" /etc/profile.d/monasca_cli.sh
|
||||
|
||||
fi
|
||||
|
||||
sudo chown root:root /etc/profile.d/monasca_cli.sh
|
||||
|
||||
sudo chmod 0644 /etc/profile.d/monasca_cli.sh
|
||||
|
||||
}
|
||||
|
||||
function clean_cli_creds {
|
||||
|
||||
echo_summary "Clean Monasca CLI Creds"
|
||||
|
||||
sudo rm -f /etc/profile.d/monasca_cli.sh
|
||||
|
||||
}
|
||||
|
||||
function install_schema {
|
||||
echo_summary "Install Monasca Schema"
|
||||
|
||||
@@ -647,11 +600,7 @@ function install_schema_metric_database_vertica {
|
||||
|
||||
function install_schema_metric_database_cassandra {
|
||||
sudo cp -f "${MONASCA_API_DIR}"/devstack/files/cassandra/cassandra_schema.cql $MONASCA_SCHEMA_DIR/cassandra_schema.cql
|
||||
if [[ ${SERVICE_HOST} ]]; then
|
||||
/usr/bin/cqlsh ${SERVICE_HOST} -f $MONASCA_SCHEMA_DIR/cassandra_schema.cql
|
||||
else
|
||||
/usr/bin/cqlsh -f $MONASCA_SCHEMA_DIR/cassandra_schema.cql
|
||||
fi
|
||||
/usr/bin/cqlsh ${SERVICE_HOST} -f $MONASCA_SCHEMA_DIR/cassandra_schema.cql
|
||||
}
|
||||
|
||||
function install_schema_kafka_topics {
|
||||
|
Reference in New Issue
Block a user