Skip to content

Commit 8043bfa

Browse files
committed
Turn off tracing for service functions
These functions commonly externally called (as part of stackrc inclusion, even) and do a fair bit of iteration over long service-lists, which really fills up the logs of devstack and grenade with unnecessary details. The functions are well tested by unit-tests, so we are very unlikely to need to debug internal issues with them in a hurry. Thus turn logging down for them. Change-Id: I63b9a05a0678c7e0c7012f6d768c29fd67f090d2
1 parent 46d50a6 commit 8043bfa

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

functions-common

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ function update_package_repo {
11471147

11481148
if is_ubuntu; then
11491149
local xtrace
1150-
xtrace=$(set +o | grep xtrace)
1150+
xtrace=$(set +o | grep xtrace)
11511151
set +o xtrace
11521152
if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
11531153
# if there are transient errors pulling the updates, that's fine.
@@ -1758,11 +1758,17 @@ function run_phase {
17581758
# remove extra commas from the input string (i.e. ``ENABLED_SERVICES``)
17591759
# _cleanup_service_list service-list
17601760
function _cleanup_service_list {
1761+
local xtrace
1762+
xtrace=$(set +o | grep xtrace)
1763+
set +o xtrace
1764+
17611765
echo "$1" | sed -e '
17621766
s/,,/,/g;
17631767
s/^,//;
17641768
s/,$//
17651769
'
1770+
1771+
$xtrace
17661772
}
17671773

17681774
# disable_all_services() removes all current services
@@ -1780,6 +1786,10 @@ function disable_all_services {
17801786
# Uses global ``ENABLED_SERVICES``
17811787
# disable_negated_services
17821788
function disable_negated_services {
1789+
local xtrace
1790+
xtrace=$(set +o | grep xtrace)
1791+
set +o xtrace
1792+
17831793
local to_remove=""
17841794
local remaining=""
17851795
local service
@@ -1797,6 +1807,8 @@ function disable_negated_services {
17971807
# go through the service list. if this service appears in the "to
17981808
# be removed" list, drop it
17991809
ENABLED_SERVICES=$(remove_disabled_services "$remaining" "$to_remove")
1810+
1811+
$xtrace
18001812
}
18011813

18021814
# disable_service() prepares the services passed as argument to be
@@ -1808,6 +1820,10 @@ function disable_negated_services {
18081820
# Uses global ``DISABLED_SERVICES``
18091821
# disable_service service [service ...]
18101822
function disable_service {
1823+
local xtrace
1824+
xtrace=$(set +o | grep xtrace)
1825+
set +o xtrace
1826+
18111827
local disabled_svcs="${DISABLED_SERVICES}"
18121828
local enabled_svcs=",${ENABLED_SERVICES},"
18131829
local service
@@ -1819,6 +1835,8 @@ function disable_service {
18191835
done
18201836
DISABLED_SERVICES=$(_cleanup_service_list "$disabled_svcs")
18211837
ENABLED_SERVICES=$(_cleanup_service_list "$enabled_svcs")
1838+
1839+
$xtrace
18221840
}
18231841

18241842
# enable_service() adds the services passed as argument to the
@@ -1832,6 +1850,10 @@ function disable_service {
18321850
# Uses global ``ENABLED_SERVICES``
18331851
# enable_service service [service ...]
18341852
function enable_service {
1853+
local xtrace
1854+
xtrace=$(set +o | grep xtrace)
1855+
set +o xtrace
1856+
18351857
local tmpsvcs="${ENABLED_SERVICES}"
18361858
local service
18371859
for service in $@; do
@@ -1845,6 +1867,8 @@ function enable_service {
18451867
done
18461868
ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
18471869
disable_negated_services
1870+
1871+
$xtrace
18481872
}
18491873

18501874
# is_service_enabled() checks if the service(s) specified as arguments are
@@ -1873,6 +1897,7 @@ function is_service_enabled {
18731897
local xtrace
18741898
xtrace=$(set +o | grep xtrace)
18751899
set +o xtrace
1900+
18761901
local enabled=1
18771902
local services=$@
18781903
local service
@@ -1898,13 +1923,18 @@ function is_service_enabled {
18981923
[[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && enabled=0
18991924
[[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && enabled=0
19001925
done
1926+
19011927
$xtrace
19021928
return $enabled
19031929
}
19041930

19051931
# remove specified list from the input string
19061932
# remove_disabled_services service-list remove-list
19071933
function remove_disabled_services {
1934+
local xtrace
1935+
xtrace=$(set +o | grep xtrace)
1936+
set +o xtrace
1937+
19081938
local service_list=$1
19091939
local remove_list=$2
19101940
local service
@@ -1923,6 +1953,9 @@ function remove_disabled_services {
19231953
enabled="${enabled},$service"
19241954
fi
19251955
done
1956+
1957+
$xtrace
1958+
19261959
_cleanup_service_list "$enabled"
19271960
}
19281961

0 commit comments

Comments
 (0)