Skip to content

Commit e3fe3fd

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Don't set xtrace directly in local call"
2 parents c756b5b + 433a9b1 commit e3fe3fd

File tree

3 files changed

+46
-23
lines changed

3 files changed

+46
-23
lines changed

functions-common

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ function write_clouds_yaml {
111111
# Accepts as True: 1 yes Yes YES true True TRUE
112112
# VAR=$(trueorfalse default-value test-value)
113113
function trueorfalse {
114-
local xtrace=$(set +o | grep xtrace)
114+
local xtrace
115+
xtrace=$(set +o | grep xtrace)
115116
set +o xtrace
116117

117118
local default=$1
@@ -169,7 +170,8 @@ function die {
169170
# die_if_not_set $LINENO env-var "message"
170171
function die_if_not_set {
171172
local exitcode=$?
172-
local xtrace=$(set +o | grep xtrace)
173+
local xtrace
174+
xtrace=$(set +o | grep xtrace)
173175
set +o xtrace
174176
local line=$1; shift
175177
local evar=$1; shift
@@ -189,7 +191,8 @@ function deprecated {
189191
# err $LINENO "message"
190192
function err {
191193
local exitcode=$?
192-
local xtrace=$(set +o | grep xtrace)
194+
local xtrace
195+
xtrace=$(set +o | grep xtrace)
193196
set +o xtrace
194197
local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
195198
echo $msg 1>&2;
@@ -206,7 +209,8 @@ function err {
206209
# err_if_not_set $LINENO env-var "message"
207210
function err_if_not_set {
208211
local exitcode=$?
209-
local xtrace=$(set +o | grep xtrace)
212+
local xtrace
213+
xtrace=$(set +o | grep xtrace)
210214
set +o xtrace
211215
local line=$1; shift
212216
local evar=$1; shift
@@ -242,7 +246,8 @@ function is_set {
242246
# warn $LINENO "message"
243247
function warn {
244248
local exitcode=$?
245-
local xtrace=$(set +o | grep xtrace)
249+
local xtrace
250+
xtrace=$(set +o | grep xtrace)
246251
set +o xtrace
247252
local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
248253
echo $msg
@@ -963,7 +968,8 @@ function _get_package_dir {
963968
# Uses globals ``OFFLINE``, ``*_proxy``
964969
# apt_get operation package [package ...]
965970
function apt_get {
966-
local xtrace=$(set +o | grep xtrace)
971+
local xtrace
972+
xtrace=$(set +o | grep xtrace)
967973
set +o xtrace
968974

969975
[[ "$OFFLINE" = "True" || -z "$@" ]] && return
@@ -1032,7 +1038,8 @@ function _parse_package_files {
10321038
# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
10331039
# of the package to the distros listed. The distro names are case insensitive.
10341040
function get_packages {
1035-
local xtrace=$(set +o | grep xtrace)
1041+
local xtrace
1042+
xtrace=$(set +o | grep xtrace)
10361043
set +o xtrace
10371044
local services=$@
10381045
local package_dir=$(_get_package_dir)
@@ -1100,7 +1107,8 @@ function get_packages {
11001107
# The same metadata used in the main DevStack prerequisite files may be used
11011108
# in these prerequisite files, see get_packages() for more info.
11021109
function get_plugin_packages {
1103-
local xtrace=$(set +o | grep xtrace)
1110+
local xtrace
1111+
xtrace=$(set +o | grep xtrace)
11041112
set +o xtrace
11051113
local files_to_parse=""
11061114
local package_dir=""
@@ -1125,7 +1133,8 @@ function update_package_repo {
11251133
fi
11261134

11271135
if is_ubuntu; then
1128-
local xtrace=$(set +o | grep xtrace)
1136+
local xtrace
1137+
xtrace=$(set +o | grep xtrace)
11291138
set +o xtrace
11301139
if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
11311140
# if there are transient errors pulling the updates, that's fine.
@@ -1841,7 +1850,8 @@ function enable_service {
18411850
# Uses global ``ENABLED_SERVICES``
18421851
# is_service_enabled service [service ...]
18431852
function is_service_enabled {
1844-
local xtrace=$(set +o | grep xtrace)
1853+
local xtrace
1854+
xtrace=$(set +o | grep xtrace)
18451855
set +o xtrace
18461856
local enabled=1
18471857
local services=$@
@@ -1920,7 +1930,8 @@ function use_exclusive_service {
19201930
# Only run the command if the target file (the last arg) is not on an
19211931
# NFS filesystem.
19221932
function _safe_permission_operation {
1923-
local xtrace=$(set +o | grep xtrace)
1933+
local xtrace
1934+
xtrace=$(set +o | grep xtrace)
19241935
set +o xtrace
19251936
local args=( $@ )
19261937
local last

inc/ini-config

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ set +o xtrace
1717
# Append a new option in an ini file without replacing the old value
1818
# iniadd [-sudo] config-file section option value1 value2 value3 ...
1919
function iniadd {
20-
local xtrace=$(set +o | grep xtrace)
20+
local xtrace
21+
xtrace=$(set +o | grep xtrace)
2122
set +o xtrace
2223
local sudo=""
2324
if [ $1 == "-sudo" ]; then
@@ -37,7 +38,8 @@ function iniadd {
3738
# Comment an option in an INI file
3839
# inicomment [-sudo] config-file section option
3940
function inicomment {
40-
local xtrace=$(set +o | grep xtrace)
41+
local xtrace
42+
xtrace=$(set +o | grep xtrace)
4143
set +o xtrace
4244
local sudo=""
4345
if [ $1 == "-sudo" ]; then
@@ -55,7 +57,8 @@ function inicomment {
5557
# Get an option from an INI file
5658
# iniget config-file section option
5759
function iniget {
58-
local xtrace=$(set +o | grep xtrace)
60+
local xtrace
61+
xtrace=$(set +o | grep xtrace)
5962
set +o xtrace
6063
local file=$1
6164
local section=$2
@@ -70,7 +73,8 @@ function iniget {
7073
# Get a multiple line option from an INI file
7174
# iniget_multiline config-file section option
7275
function iniget_multiline {
73-
local xtrace=$(set +o | grep xtrace)
76+
local xtrace
77+
xtrace=$(set +o | grep xtrace)
7478
set +o xtrace
7579
local file=$1
7680
local section=$2
@@ -85,7 +89,8 @@ function iniget_multiline {
8589
# Determinate is the given option present in the INI file
8690
# ini_has_option config-file section option
8791
function ini_has_option {
88-
local xtrace=$(set +o | grep xtrace)
92+
local xtrace
93+
xtrace=$(set +o | grep xtrace)
8994
set +o xtrace
9095
local file=$1
9196
local section=$2
@@ -107,7 +112,8 @@ function ini_has_option {
107112
#
108113
# iniadd_literal [-sudo] config-file section option value
109114
function iniadd_literal {
110-
local xtrace=$(set +o | grep xtrace)
115+
local xtrace
116+
xtrace=$(set +o | grep xtrace)
111117
set +o xtrace
112118
local sudo=""
113119
if [ $1 == "-sudo" ]; then
@@ -135,7 +141,8 @@ $option = $value
135141
# Remove an option from an INI file
136142
# inidelete [-sudo] config-file section option
137143
function inidelete {
138-
local xtrace=$(set +o | grep xtrace)
144+
local xtrace
145+
xtrace=$(set +o | grep xtrace)
139146
set +o xtrace
140147
local sudo=""
141148
if [ $1 == "-sudo" ]; then
@@ -161,7 +168,8 @@ function inidelete {
161168
# iniset [-sudo] config-file section option value
162169
# - if the file does not exist, it is created
163170
function iniset {
164-
local xtrace=$(set +o | grep xtrace)
171+
local xtrace
172+
xtrace=$(set +o | grep xtrace)
165173
set +o xtrace
166174
local sudo=""
167175
if [ $1 == "-sudo" ]; then
@@ -198,7 +206,8 @@ $option = $value
198206
# Set a multiple line option in an INI file
199207
# iniset_multiline [-sudo] config-file section option value1 value2 valu3 ...
200208
function iniset_multiline {
201-
local xtrace=$(set +o | grep xtrace)
209+
local xtrace
210+
xtrace=$(set +o | grep xtrace)
202211
set +o xtrace
203212
local sudo=""
204213
if [ $1 == "-sudo" ]; then
@@ -236,7 +245,8 @@ $option = $v
236245
# Uncomment an option in an INI file
237246
# iniuncomment config-file section option
238247
function iniuncomment {
239-
local xtrace=$(set +o | grep xtrace)
248+
local xtrace
249+
xtrace=$(set +o | grep xtrace)
240250
set +o xtrace
241251
local sudo=""
242252
if [ $1 == "-sudo" ]; then

inc/python

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function get_pip_command {
3838
# Get the path to the direcotry where python executables are installed.
3939
# get_python_exec_prefix
4040
function get_python_exec_prefix {
41-
local xtrace=$(set +o | grep xtrace)
41+
local xtrace
42+
xtrace=$(set +o | grep xtrace)
4243
set +o xtrace
4344
if [[ -z "$os_PACKAGE" ]]; then
4445
GetOSVersion
@@ -69,7 +70,8 @@ function pip_install_gr {
6970
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
7071
# pip_install package [package ...]
7172
function pip_install {
72-
local xtrace=$(set +o | grep xtrace)
73+
local xtrace
74+
xtrace=$(set +o | grep xtrace)
7375
set +o xtrace
7476
local upgrade=""
7577
local offline=${OFFLINE:-False}

0 commit comments

Comments
 (0)