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
diff --git a/functions-common b/functions-common
index 446de53..705c314 100644
--- a/functions-common
+++ b/functions-common
@@ -1803,8 +1803,7 @@
# 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()