From e4212ab9dc23be9d0aa9f2593e20c78aa0e9c2c2 Mon Sep 17 00:00:00 2001 From: Martin Kulhavy Date: Tue, 22 Aug 2017 14:07:07 +0300 Subject: Move tools.sh to ci/common dir This file is only sourced by other script and is not meant to be executed (contains only functions). Change-Id: I41253b73f720e4b7e987c5164901253c7e51ee8b Signed-off-by: Martin Kulhavy --- ci/03-maasdeploy.sh | 2 +- ci/cleanvm.sh | 2 +- ci/common/tools.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ ci/deploy.sh | 2 +- ci/openstack.sh | 2 +- ci/setupproxy.sh | 2 +- ci/tools.sh | 62 ----------------------------------------------------- 7 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 ci/common/tools.sh delete mode 100644 ci/tools.sh diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index fb599e68..988ea839 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -2,7 +2,7 @@ #placeholder for deployment script. set -ex -source tools.sh +source common/tools.sh usage() { diff --git a/ci/cleanvm.sh b/ci/cleanvm.sh index 8d6fe88d..0fa6b869 100755 --- a/ci/cleanvm.sh +++ b/ci/cleanvm.sh @@ -2,7 +2,7 @@ set -x -source tools.sh +source common/tools.sh echo_info "Cleanup Started..." diff --git a/ci/common/tools.sh b/ci/common/tools.sh new file mode 100644 index 00000000..45db67e1 --- /dev/null +++ b/ci/common/tools.sh @@ -0,0 +1,62 @@ +############################################################################## +# Copyright (c) 2017 Nokia and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# include only once +[ ! -z "$_tools_included" ] && return || readonly _tools_included=true + +####################################### +# Echo printing in yellow bold color +# Arguments: +# Same as for echo +# Returns: +# None +####################################### +function echo_info { ( + # don't clutter the script output with the xtrace of the echo command + { set +x; } 2> /dev/null + + yellow_bold='\033[1;33m' + color_off='\033[0m' + echo "${@:1:($#-1)}" -e "$yellow_bold${@: -1}$color_off"; + ) +} + +####################################### +# Echo error (to stderr) +# Arguments: +# Same as for echo +# Returns: +# None +####################################### +function echo_error { ( + # don't clutter the script output with the xtrace of the echo command + { set +x; } 2> /dev/null + + red_bold='\033[1;31m' + color_off='\033[0m' + >&2 echo "${@:1:($#-1)}" -e "$red_bold${@: -1}$color_off"; + ) +} + +####################################### +# Echo warning (to stderr) +# Arguments: +# Same as for echo +# Returns: +# None +####################################### +function echo_warning { ( + # don't clutter the script output with the xtrace of the echo command + { set +x; } 2> /dev/null + + red_italic='\033[3;91m' + color_off='\033[0m' + >&2 echo "${@:1:($#-1)}" -e "$red_italic${@: -1}$color_off"; + ) +} diff --git a/ci/deploy.sh b/ci/deploy.sh index 8a08f57d..066b457b 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -2,7 +2,7 @@ set -ex -source tools.sh +source common/tools.sh #need to put multiple cases here where decide this bundle to deploy by default use the odl bundle. # Below parameters are the default and we can according the release diff --git a/ci/openstack.sh b/ci/openstack.sh index 0e2f9e4d..151e60e7 100755 --- a/ci/openstack.sh +++ b/ci/openstack.sh @@ -8,7 +8,7 @@ set -ex -source tools.sh +source common/tools.sh #./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true diff --git a/ci/setupproxy.sh b/ci/setupproxy.sh index 61eabcd9..913252fc 100644 --- a/ci/setupproxy.sh +++ b/ci/setupproxy.sh @@ -28,7 +28,7 @@ ############################################################################## # Imports -source tools.sh +source common/tools.sh # Halt on error set -e diff --git a/ci/tools.sh b/ci/tools.sh deleted file mode 100644 index 45db67e1..00000000 --- a/ci/tools.sh +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################## -# Copyright (c) 2017 Nokia and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -# include only once -[ ! -z "$_tools_included" ] && return || readonly _tools_included=true - -####################################### -# Echo printing in yellow bold color -# Arguments: -# Same as for echo -# Returns: -# None -####################################### -function echo_info { ( - # don't clutter the script output with the xtrace of the echo command - { set +x; } 2> /dev/null - - yellow_bold='\033[1;33m' - color_off='\033[0m' - echo "${@:1:($#-1)}" -e "$yellow_bold${@: -1}$color_off"; - ) -} - -####################################### -# Echo error (to stderr) -# Arguments: -# Same as for echo -# Returns: -# None -####################################### -function echo_error { ( - # don't clutter the script output with the xtrace of the echo command - { set +x; } 2> /dev/null - - red_bold='\033[1;31m' - color_off='\033[0m' - >&2 echo "${@:1:($#-1)}" -e "$red_bold${@: -1}$color_off"; - ) -} - -####################################### -# Echo warning (to stderr) -# Arguments: -# Same as for echo -# Returns: -# None -####################################### -function echo_warning { ( - # don't clutter the script output with the xtrace of the echo command - { set +x; } 2> /dev/null - - red_italic='\033[3;91m' - color_off='\033[0m' - >&2 echo "${@:1:($#-1)}" -e "$red_italic${@: -1}$color_off"; - ) -} -- cgit 1.2.3-korg