Browse code

Merge "Don't set xtrace directly in local call"

Jenkins authored on 2015/10/08 20:45:17
Showing 3 changed files
... ...
@@ -111,7 +111,8 @@ function write_clouds_yaml {
111 111
 # Accepts as True: 1 yes Yes YES true True TRUE
112 112
 # VAR=$(trueorfalse default-value test-value)
113 113
 function trueorfalse {
114
-    local xtrace=$(set +o | grep xtrace)
114
+    local xtrace
115
+    xtrace=$(set +o | grep xtrace)
115 116
     set +o xtrace
116 117
 
117 118
     local default=$1
... ...
@@ -169,7 +170,8 @@ function die {
169 169
 # die_if_not_set $LINENO env-var "message"
170 170
 function die_if_not_set {
171 171
     local exitcode=$?
172
-    local xtrace=$(set +o | grep xtrace)
172
+    local xtrace
173
+    xtrace=$(set +o | grep xtrace)
173 174
     set +o xtrace
174 175
     local line=$1; shift
175 176
     local evar=$1; shift
... ...
@@ -189,7 +191,8 @@ function deprecated {
189 189
 # err $LINENO "message"
190 190
 function err {
191 191
     local exitcode=$?
192
-    local xtrace=$(set +o | grep xtrace)
192
+    local xtrace
193
+    xtrace=$(set +o | grep xtrace)
193 194
     set +o xtrace
194 195
     local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
195 196
     echo $msg 1>&2;
... ...
@@ -206,7 +209,8 @@ function err {
206 206
 # err_if_not_set $LINENO env-var "message"
207 207
 function err_if_not_set {
208 208
     local exitcode=$?
209
-    local xtrace=$(set +o | grep xtrace)
209
+    local xtrace
210
+    xtrace=$(set +o | grep xtrace)
210 211
     set +o xtrace
211 212
     local line=$1; shift
212 213
     local evar=$1; shift
... ...
@@ -242,7 +246,8 @@ function is_set {
242 242
 # warn $LINENO "message"
243 243
 function warn {
244 244
     local exitcode=$?
245
-    local xtrace=$(set +o | grep xtrace)
245
+    local xtrace
246
+    xtrace=$(set +o | grep xtrace)
246 247
     set +o xtrace
247 248
     local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
248 249
     echo $msg
... ...
@@ -963,7 +968,8 @@ function _get_package_dir {
963 963
 # Uses globals ``OFFLINE``, ``*_proxy``
964 964
 # apt_get operation package [package ...]
965 965
 function apt_get {
966
-    local xtrace=$(set +o | grep xtrace)
966
+    local xtrace
967
+    xtrace=$(set +o | grep xtrace)
967 968
     set +o xtrace
968 969
 
969 970
     [[ "$OFFLINE" = "True" || -z "$@" ]] && return
... ...
@@ -1032,7 +1038,8 @@ function _parse_package_files {
1032 1032
 # - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
1033 1033
 #   of the package to the distros listed.  The distro names are case insensitive.
1034 1034
 function get_packages {
1035
-    local xtrace=$(set +o | grep xtrace)
1035
+    local xtrace
1036
+    xtrace=$(set +o | grep xtrace)
1036 1037
     set +o xtrace
1037 1038
     local services=$@
1038 1039
     local package_dir=$(_get_package_dir)
... ...
@@ -1100,7 +1107,8 @@ function get_packages {
1100 1100
 # The same metadata used in the main DevStack prerequisite files may be used
1101 1101
 # in these prerequisite files, see get_packages() for more info.
1102 1102
 function get_plugin_packages {
1103
-    local xtrace=$(set +o | grep xtrace)
1103
+    local xtrace
1104
+    xtrace=$(set +o | grep xtrace)
1104 1105
     set +o xtrace
1105 1106
     local files_to_parse=""
1106 1107
     local package_dir=""
... ...
@@ -1125,7 +1133,8 @@ function update_package_repo {
1125 1125
     fi
1126 1126
 
1127 1127
     if is_ubuntu; then
1128
-        local xtrace=$(set +o | grep xtrace)
1128
+        local xtrace
1129
+    xtrace=$(set +o | grep xtrace)
1129 1130
         set +o xtrace
1130 1131
         if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
1131 1132
             # if there are transient errors pulling the updates, that's fine.
... ...
@@ -1841,7 +1850,8 @@ function enable_service {
1841 1841
 # Uses global ``ENABLED_SERVICES``
1842 1842
 # is_service_enabled service [service ...]
1843 1843
 function is_service_enabled {
1844
-    local xtrace=$(set +o | grep xtrace)
1844
+    local xtrace
1845
+    xtrace=$(set +o | grep xtrace)
1845 1846
     set +o xtrace
1846 1847
     local enabled=1
1847 1848
     local services=$@
... ...
@@ -1920,7 +1930,8 @@ function use_exclusive_service {
1920 1920
 # Only run the command if the target file (the last arg) is not on an
1921 1921
 # NFS filesystem.
1922 1922
 function _safe_permission_operation {
1923
-    local xtrace=$(set +o | grep xtrace)
1923
+    local xtrace
1924
+    xtrace=$(set +o | grep xtrace)
1924 1925
     set +o xtrace
1925 1926
     local args=( $@ )
1926 1927
     local last
... ...
@@ -17,7 +17,8 @@ set +o xtrace
17 17
 # Append a new option in an ini file without replacing the old value
18 18
 # iniadd [-sudo] config-file section option value1 value2 value3 ...
19 19
 function iniadd {
20
-    local xtrace=$(set +o | grep xtrace)
20
+    local xtrace
21
+    xtrace=$(set +o | grep xtrace)
21 22
     set +o xtrace
22 23
     local sudo=""
23 24
     if [ $1 == "-sudo" ]; then
... ...
@@ -37,7 +38,8 @@ function iniadd {
37 37
 # Comment an option in an INI file
38 38
 # inicomment [-sudo] config-file section option
39 39
 function inicomment {
40
-    local xtrace=$(set +o | grep xtrace)
40
+    local xtrace
41
+    xtrace=$(set +o | grep xtrace)
41 42
     set +o xtrace
42 43
     local sudo=""
43 44
     if [ $1 == "-sudo" ]; then
... ...
@@ -55,7 +57,8 @@ function inicomment {
55 55
 # Get an option from an INI file
56 56
 # iniget config-file section option
57 57
 function iniget {
58
-    local xtrace=$(set +o | grep xtrace)
58
+    local xtrace
59
+    xtrace=$(set +o | grep xtrace)
59 60
     set +o xtrace
60 61
     local file=$1
61 62
     local section=$2
... ...
@@ -70,7 +73,8 @@ function iniget {
70 70
 # Get a multiple line option from an INI file
71 71
 # iniget_multiline config-file section option
72 72
 function iniget_multiline {
73
-    local xtrace=$(set +o | grep xtrace)
73
+    local xtrace
74
+    xtrace=$(set +o | grep xtrace)
74 75
     set +o xtrace
75 76
     local file=$1
76 77
     local section=$2
... ...
@@ -85,7 +89,8 @@ function iniget_multiline {
85 85
 # Determinate is the given option present in the INI file
86 86
 # ini_has_option config-file section option
87 87
 function ini_has_option {
88
-    local xtrace=$(set +o | grep xtrace)
88
+    local xtrace
89
+    xtrace=$(set +o | grep xtrace)
89 90
     set +o xtrace
90 91
     local file=$1
91 92
     local section=$2
... ...
@@ -107,7 +112,8 @@ function ini_has_option {
107 107
 #
108 108
 # iniadd_literal [-sudo] config-file section option value
109 109
 function iniadd_literal {
110
-    local xtrace=$(set +o | grep xtrace)
110
+    local xtrace
111
+    xtrace=$(set +o | grep xtrace)
111 112
     set +o xtrace
112 113
     local sudo=""
113 114
     if [ $1 == "-sudo" ]; then
... ...
@@ -135,7 +141,8 @@ $option = $value
135 135
 # Remove an option from an INI file
136 136
 # inidelete [-sudo] config-file section option
137 137
 function inidelete {
138
-    local xtrace=$(set +o | grep xtrace)
138
+    local xtrace
139
+    xtrace=$(set +o | grep xtrace)
139 140
     set +o xtrace
140 141
     local sudo=""
141 142
     if [ $1 == "-sudo" ]; then
... ...
@@ -161,7 +168,8 @@ function inidelete {
161 161
 # iniset [-sudo] config-file section option value
162 162
 #  - if the file does not exist, it is created
163 163
 function iniset {
164
-    local xtrace=$(set +o | grep xtrace)
164
+    local xtrace
165
+    xtrace=$(set +o | grep xtrace)
165 166
     set +o xtrace
166 167
     local sudo=""
167 168
     if [ $1 == "-sudo" ]; then
... ...
@@ -198,7 +206,8 @@ $option = $value
198 198
 # Set a multiple line option in an INI file
199 199
 # iniset_multiline [-sudo] config-file section option value1 value2 valu3 ...
200 200
 function iniset_multiline {
201
-    local xtrace=$(set +o | grep xtrace)
201
+    local xtrace
202
+    xtrace=$(set +o | grep xtrace)
202 203
     set +o xtrace
203 204
     local sudo=""
204 205
     if [ $1 == "-sudo" ]; then
... ...
@@ -236,7 +245,8 @@ $option = $v
236 236
 # Uncomment an option in an INI file
237 237
 # iniuncomment config-file section option
238 238
 function iniuncomment {
239
-    local xtrace=$(set +o | grep xtrace)
239
+    local xtrace
240
+    xtrace=$(set +o | grep xtrace)
240 241
     set +o xtrace
241 242
     local sudo=""
242 243
     if [ $1 == "-sudo" ]; then
... ...
@@ -38,7 +38,8 @@ function get_pip_command {
38 38
 # Get the path to the direcotry where python executables are installed.
39 39
 # get_python_exec_prefix
40 40
 function get_python_exec_prefix {
41
-    local xtrace=$(set +o | grep xtrace)
41
+    local xtrace
42
+    xtrace=$(set +o | grep xtrace)
42 43
     set +o xtrace
43 44
     if [[ -z "$os_PACKAGE" ]]; then
44 45
         GetOSVersion
... ...
@@ -69,7 +70,8 @@ function pip_install_gr {
69 69
 # ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
70 70
 # pip_install package [package ...]
71 71
 function pip_install {
72
-    local xtrace=$(set +o | grep xtrace)
72
+    local xtrace
73
+    xtrace=$(set +o | grep xtrace)
73 74
     set +o xtrace
74 75
     local upgrade=""
75 76
     local offline=${OFFLINE:-False}