From 3db0aad63c182a88830ec61fc048240058c02d85 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Thu, 10 Sep 2015 11:15:39 +0000 Subject: [PATCH] Fix is_service_enabled when using multiple arguments is_service_enabled might actually fail to return the expected result if there is a is_${service}_enabled function available and multiple services are checked. For example, if one defines swift as a service but disables glance, the following check fails: if is_service_enabled swift glance horizon; then install_swiftclient fi This is because the second for-iteration resets the local "enabled" var again to 1 and finally exits with 1 as a return code. This patch fixes this. Change-Id: Ic76b72897efe9597d1412470353895001a1a4c66 --- functions-common | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions-common b/functions-common index 446de5374f..705c3149dd 100644 --- a/functions-common +++ b/functions-common @@ -1803,8 +1803,7 @@ function is_service_enabled { # Look for top-level 'enabled' function for this service if type is_${service}_enabled >/dev/null 2>&1; then # A function exists for this service, use it - is_${service}_enabled - enabled=$? + is_${service}_enabled && enabled=0 fi # TODO(dtroyer): Remove these legacy special-cases after the is_XXX_enabled()