From 8043bfaf5ec6059e7245ff397672b1da0e563013 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 14 Oct 2015 14:53:18 +1100 Subject: [PATCH] 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 --- functions-common | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/functions-common b/functions-common index be3f81c412..c8f551de3c 100644 --- a/functions-common +++ b/functions-common @@ -1147,7 +1147,7 @@ function update_package_repo { if is_ubuntu; then local xtrace - xtrace=$(set +o | grep xtrace) + xtrace=$(set +o | grep xtrace) set +o xtrace if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then # if there are transient errors pulling the updates, that's fine. @@ -1758,11 +1758,17 @@ function run_phase { # remove extra commas from the input string (i.e. ``ENABLED_SERVICES``) # _cleanup_service_list service-list function _cleanup_service_list { + local xtrace + xtrace=$(set +o | grep xtrace) + set +o xtrace + echo "$1" | sed -e ' s/,,/,/g; s/^,//; s/,$// ' + + $xtrace } # disable_all_services() removes all current services @@ -1780,6 +1786,10 @@ function disable_all_services { # Uses global ``ENABLED_SERVICES`` # disable_negated_services function disable_negated_services { + local xtrace + xtrace=$(set +o | grep xtrace) + set +o xtrace + local to_remove="" local remaining="" local service @@ -1797,6 +1807,8 @@ function disable_negated_services { # go through the service list. if this service appears in the "to # be removed" list, drop it ENABLED_SERVICES=$(remove_disabled_services "$remaining" "$to_remove") + + $xtrace } # disable_service() prepares the services passed as argument to be @@ -1808,6 +1820,10 @@ function disable_negated_services { # Uses global ``DISABLED_SERVICES`` # disable_service service [service ...] function disable_service { + local xtrace + xtrace=$(set +o | grep xtrace) + set +o xtrace + local disabled_svcs="${DISABLED_SERVICES}" local enabled_svcs=",${ENABLED_SERVICES}," local service @@ -1819,6 +1835,8 @@ function disable_service { done DISABLED_SERVICES=$(_cleanup_service_list "$disabled_svcs") ENABLED_SERVICES=$(_cleanup_service_list "$enabled_svcs") + + $xtrace } # enable_service() adds the services passed as argument to the @@ -1832,6 +1850,10 @@ function disable_service { # Uses global ``ENABLED_SERVICES`` # enable_service service [service ...] function enable_service { + local xtrace + xtrace=$(set +o | grep xtrace) + set +o xtrace + local tmpsvcs="${ENABLED_SERVICES}" local service for service in $@; do @@ -1845,6 +1867,8 @@ function enable_service { done ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs") disable_negated_services + + $xtrace } # is_service_enabled() checks if the service(s) specified as arguments are @@ -1873,6 +1897,7 @@ function is_service_enabled { local xtrace xtrace=$(set +o | grep xtrace) set +o xtrace + local enabled=1 local services=$@ local service @@ -1898,6 +1923,7 @@ function is_service_enabled { [[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && enabled=0 [[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && enabled=0 done + $xtrace return $enabled } @@ -1905,6 +1931,10 @@ function is_service_enabled { # remove specified list from the input string # remove_disabled_services service-list remove-list function remove_disabled_services { + local xtrace + xtrace=$(set +o | grep xtrace) + set +o xtrace + local service_list=$1 local remove_list=$2 local service @@ -1923,6 +1953,9 @@ function remove_disabled_services { enabled="${enabled},$service" fi done + + $xtrace + _cleanup_service_list "$enabled" }