47ac546217
Listed below are the errors which were fixed as well as the actions taken to fix them: E010: do not on the same line as for --> let do and for in the same line E011: then not on the same line as if or elif --> let then and if or elif in the same line E020: Function declaration not in format ^function name {$ --> fix the format to suit ^function name {$ E041: Usage of $[ for arithmetic is deprecated for $(( --> fix from $[ to $(( E043: arithmetic compound has inconsistent return semantics --> do not use +=, ++, -=, --; use value=value+? instead. E001: check that lines do not end with trailing whitespace --> delete trailing whitespace E003: ensure all indents are a multiple of 4 spaces --> add/delete spaces E042: local declaration hides errors --> let declaration and assignment in two lines. Listed below are test cases done which run one controller and one compute in KVMs Test-Install ---- success Related: https://review.openstack.org/#/c/600663/ https://review.openstack.org/#/c/601221/ Story: 2003360 Task: 26213 Change-Id: I3ece37db3a326ea58bd344f43beefcbbbd4f0ad4 Signed-off-by: SidneyAn <ran1.an@intel.com>
57 lines
1.5 KiB
Bash
57 lines
1.5 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2016-2017 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
# Migrates ceilometer pipeline file.
|
|
|
|
. /usr/bin/tsconfig
|
|
|
|
NAME=$(basename $0)
|
|
|
|
# The migration scripts are passed these parameters:
|
|
FROM_RELEASE=$1
|
|
TO_RELEASE=$2
|
|
ACTION=$3
|
|
|
|
# This will log to /var/log/platform.log
|
|
function log {
|
|
logger -p local1.info $1
|
|
}
|
|
|
|
OLD_PIPELINE_FILE="${CGCS_PATH}/ceilometer/${FROM_RELEASE}/pipeline.yaml"
|
|
NEW_PIPELINE_DIR="${CGCS_PATH}/ceilometer/${TO_RELEASE}"
|
|
NEW_PIPELINE_FILE="${NEW_PIPELINE_DIR}/pipeline.yaml"
|
|
PIPELINE_SOURCE_FILE=/etc/ceilometer/controller.yaml
|
|
|
|
function do_escape {
|
|
local val=$1
|
|
local val_escaped="${val//\//\\/}"
|
|
val_escaped="${val_escaped//\&/\\&}"
|
|
echo $val_escaped
|
|
}
|
|
|
|
if [ "$ACTION" == "migrate" ]; then
|
|
log "Creating new $NEW_PIPELINE_FILE file for release $TO_RELEASE"
|
|
if [ ! -d "$NEW_PIPELINE_DIR" ]; then
|
|
mkdir $NEW_PIPELINE_DIR
|
|
fi
|
|
cp $PIPELINE_SOURCE_FILE $NEW_PIPELINE_FILE
|
|
|
|
# Currently, the user can only modify the vswitch.csv and pm.csv paths.
|
|
default_value=$(do_escape "$(awk '/vswitch.csv/ {print $0}' $NEW_PIPELINE_FILE)")
|
|
custom_value=$(do_escape "$(awk '/vswitch.csv/ {print $0}' $OLD_PIPELINE_FILE)")
|
|
sed -i "s/$default_value/$custom_value/" $NEW_PIPELINE_FILE
|
|
|
|
default_value=$(do_escape "$(awk '/pm.csv/ {print $0}' $NEW_PIPELINE_FILE)")
|
|
custom_value=$(do_escape "$(awk '/pm.csv/ {print $0}' $OLD_PIPELINE_FILE)")
|
|
sed -i "s/$default_value/$custom_value/" $NEW_PIPELINE_FILE
|
|
|
|
chmod 640 $NEW_PIPELINE_FILE
|
|
|
|
fi
|
|
|
|
exit 0
|