Don't set xtrace directly in local call
Ia0957b47187c3dcadd46154b17022c4213781112 detects setting local variables with subshell commands. Although this is a particuarly benign case, it trips the test. Rather than putting in an ignore for this, we can easily change it to make the test pass. This seems better than putting in special work-arounds to bashate, etc. Change-Id: I37c3967c0f2d780a636a7d26cda83755085c5c69
This commit is contained in:
parent
561137e88a
commit
433a9b10dd
@ -111,7 +111,8 @@ function write_clouds_yaml {
|
|||||||
# Accepts as True: 1 yes Yes YES true True TRUE
|
# Accepts as True: 1 yes Yes YES true True TRUE
|
||||||
# VAR=$(trueorfalse default-value test-value)
|
# VAR=$(trueorfalse default-value test-value)
|
||||||
function trueorfalse {
|
function trueorfalse {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
|
|
||||||
local default=$1
|
local default=$1
|
||||||
@ -169,7 +170,8 @@ function die {
|
|||||||
# die_if_not_set $LINENO env-var "message"
|
# die_if_not_set $LINENO env-var "message"
|
||||||
function die_if_not_set {
|
function die_if_not_set {
|
||||||
local exitcode=$?
|
local exitcode=$?
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local line=$1; shift
|
local line=$1; shift
|
||||||
local evar=$1; shift
|
local evar=$1; shift
|
||||||
@ -183,7 +185,8 @@ function die_if_not_set {
|
|||||||
# err $LINENO "message"
|
# err $LINENO "message"
|
||||||
function err {
|
function err {
|
||||||
local exitcode=$?
|
local exitcode=$?
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
|
local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
|
||||||
echo $msg 1>&2;
|
echo $msg 1>&2;
|
||||||
@ -200,7 +203,8 @@ function err {
|
|||||||
# err_if_not_set $LINENO env-var "message"
|
# err_if_not_set $LINENO env-var "message"
|
||||||
function err_if_not_set {
|
function err_if_not_set {
|
||||||
local exitcode=$?
|
local exitcode=$?
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local line=$1; shift
|
local line=$1; shift
|
||||||
local evar=$1; shift
|
local evar=$1; shift
|
||||||
@ -236,7 +240,8 @@ function is_set {
|
|||||||
# warn $LINENO "message"
|
# warn $LINENO "message"
|
||||||
function warn {
|
function warn {
|
||||||
local exitcode=$?
|
local exitcode=$?
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
|
local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
|
||||||
echo $msg
|
echo $msg
|
||||||
@ -986,7 +991,8 @@ function _get_package_dir {
|
|||||||
# Uses globals ``OFFLINE``, ``*_proxy``
|
# Uses globals ``OFFLINE``, ``*_proxy``
|
||||||
# apt_get operation package [package ...]
|
# apt_get operation package [package ...]
|
||||||
function apt_get {
|
function apt_get {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
|
|
||||||
[[ "$OFFLINE" = "True" || -z "$@" ]] && return
|
[[ "$OFFLINE" = "True" || -z "$@" ]] && return
|
||||||
@ -1055,7 +1061,8 @@ function _parse_package_files {
|
|||||||
# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
|
# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
|
||||||
# of the package to the distros listed. The distro names are case insensitive.
|
# of the package to the distros listed. The distro names are case insensitive.
|
||||||
function get_packages {
|
function get_packages {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local services=$@
|
local services=$@
|
||||||
local package_dir=$(_get_package_dir)
|
local package_dir=$(_get_package_dir)
|
||||||
@ -1123,7 +1130,8 @@ function get_packages {
|
|||||||
# The same metadata used in the main DevStack prerequisite files may be used
|
# The same metadata used in the main DevStack prerequisite files may be used
|
||||||
# in these prerequisite files, see get_packages() for more info.
|
# in these prerequisite files, see get_packages() for more info.
|
||||||
function get_plugin_packages {
|
function get_plugin_packages {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local files_to_parse=""
|
local files_to_parse=""
|
||||||
local package_dir=""
|
local package_dir=""
|
||||||
@ -1148,7 +1156,8 @@ function update_package_repo {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if is_ubuntu; then
|
if is_ubuntu; then
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
|
if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
|
||||||
# if there are transient errors pulling the updates, that's fine.
|
# if there are transient errors pulling the updates, that's fine.
|
||||||
@ -1854,7 +1863,8 @@ function enable_service {
|
|||||||
# Uses global ``ENABLED_SERVICES``
|
# Uses global ``ENABLED_SERVICES``
|
||||||
# is_service_enabled service [service ...]
|
# is_service_enabled service [service ...]
|
||||||
function is_service_enabled {
|
function is_service_enabled {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local enabled=1
|
local enabled=1
|
||||||
local services=$@
|
local services=$@
|
||||||
@ -1933,7 +1943,8 @@ function use_exclusive_service {
|
|||||||
# Only run the command if the target file (the last arg) is not on an
|
# Only run the command if the target file (the last arg) is not on an
|
||||||
# NFS filesystem.
|
# NFS filesystem.
|
||||||
function _safe_permission_operation {
|
function _safe_permission_operation {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local args=( $@ )
|
local args=( $@ )
|
||||||
local last
|
local last
|
||||||
|
@ -17,7 +17,8 @@ set +o xtrace
|
|||||||
# Append a new option in an ini file without replacing the old value
|
# Append a new option in an ini file without replacing the old value
|
||||||
# iniadd [-sudo] config-file section option value1 value2 value3 ...
|
# iniadd [-sudo] config-file section option value1 value2 value3 ...
|
||||||
function iniadd {
|
function iniadd {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
@ -37,7 +38,8 @@ function iniadd {
|
|||||||
# Comment an option in an INI file
|
# Comment an option in an INI file
|
||||||
# inicomment [-sudo] config-file section option
|
# inicomment [-sudo] config-file section option
|
||||||
function inicomment {
|
function inicomment {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
@ -55,7 +57,8 @@ function inicomment {
|
|||||||
# Get an option from an INI file
|
# Get an option from an INI file
|
||||||
# iniget config-file section option
|
# iniget config-file section option
|
||||||
function iniget {
|
function iniget {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local file=$1
|
local file=$1
|
||||||
local section=$2
|
local section=$2
|
||||||
@ -70,7 +73,8 @@ function iniget {
|
|||||||
# Get a multiple line option from an INI file
|
# Get a multiple line option from an INI file
|
||||||
# iniget_multiline config-file section option
|
# iniget_multiline config-file section option
|
||||||
function iniget_multiline {
|
function iniget_multiline {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local file=$1
|
local file=$1
|
||||||
local section=$2
|
local section=$2
|
||||||
@ -85,7 +89,8 @@ function iniget_multiline {
|
|||||||
# Determinate is the given option present in the INI file
|
# Determinate is the given option present in the INI file
|
||||||
# ini_has_option config-file section option
|
# ini_has_option config-file section option
|
||||||
function ini_has_option {
|
function ini_has_option {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local file=$1
|
local file=$1
|
||||||
local section=$2
|
local section=$2
|
||||||
@ -107,7 +112,8 @@ function ini_has_option {
|
|||||||
#
|
#
|
||||||
# iniadd_literal [-sudo] config-file section option value
|
# iniadd_literal [-sudo] config-file section option value
|
||||||
function iniadd_literal {
|
function iniadd_literal {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
@ -135,7 +141,8 @@ $option = $value
|
|||||||
# Remove an option from an INI file
|
# Remove an option from an INI file
|
||||||
# inidelete [-sudo] config-file section option
|
# inidelete [-sudo] config-file section option
|
||||||
function inidelete {
|
function inidelete {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
@ -161,7 +168,8 @@ function inidelete {
|
|||||||
# iniset [-sudo] config-file section option value
|
# iniset [-sudo] config-file section option value
|
||||||
# - if the file does not exist, it is created
|
# - if the file does not exist, it is created
|
||||||
function iniset {
|
function iniset {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
@ -198,7 +206,8 @@ $option = $value
|
|||||||
# Set a multiple line option in an INI file
|
# Set a multiple line option in an INI file
|
||||||
# iniset_multiline [-sudo] config-file section option value1 value2 valu3 ...
|
# iniset_multiline [-sudo] config-file section option value1 value2 valu3 ...
|
||||||
function iniset_multiline {
|
function iniset_multiline {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
@ -236,7 +245,8 @@ $option = $v
|
|||||||
# Uncomment an option in an INI file
|
# Uncomment an option in an INI file
|
||||||
# iniuncomment config-file section option
|
# iniuncomment config-file section option
|
||||||
function iniuncomment {
|
function iniuncomment {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local sudo=""
|
local sudo=""
|
||||||
if [ $1 == "-sudo" ]; then
|
if [ $1 == "-sudo" ]; then
|
||||||
|
@ -38,7 +38,8 @@ function get_pip_command {
|
|||||||
# Get the path to the direcotry where python executables are installed.
|
# Get the path to the direcotry where python executables are installed.
|
||||||
# get_python_exec_prefix
|
# get_python_exec_prefix
|
||||||
function get_python_exec_prefix {
|
function get_python_exec_prefix {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
if [[ -z "$os_PACKAGE" ]]; then
|
if [[ -z "$os_PACKAGE" ]]; then
|
||||||
GetOSVersion
|
GetOSVersion
|
||||||
@ -69,7 +70,8 @@ function pip_install_gr {
|
|||||||
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
|
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
|
||||||
# pip_install package [package ...]
|
# pip_install package [package ...]
|
||||||
function pip_install {
|
function pip_install {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace
|
||||||
|
xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
local upgrade=""
|
local upgrade=""
|
||||||
local offline=${OFFLINE:-False}
|
local offline=${OFFLINE:-False}
|
||||||
|
Loading…
Reference in New Issue
Block a user