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
| ... | ... |
@@ -1803,8 +1803,7 @@ function is_service_enabled {
|
| 1803 | 1803 |
# Look for top-level 'enabled' function for this service |
| 1804 | 1804 |
if type is_${service}_enabled >/dev/null 2>&1; then
|
| 1805 | 1805 |
# A function exists for this service, use it |
| 1806 |
- is_${service}_enabled
|
|
| 1807 |
- enabled=$? |
|
| 1806 |
+ is_${service}_enabled && enabled=0
|
|
| 1808 | 1807 |
fi |
| 1809 | 1808 |
|
| 1810 | 1809 |
# TODO(dtroyer): Remove these legacy special-cases after the is_XXX_enabled() |