From 7a7a4667386424b949a9e4e1c65683d71a1161fe Mon Sep 17 00:00:00 2001 From: Matthieu Huin Date: Mon, 15 Apr 2013 17:13:41 +0200 Subject: [PATCH] Removes "RPC not enabled" error message when no backend is needed When no service needing a RPC backend is activated, no error message should appear if a RPC backend is not installed. A simple check is done on the services installation files to see which services need to initialize a RPC backend at some point; if none of these services are in ENABLED_SERVICES then the error message is skipped. Change-Id: I4e47e0c675c74775b4ea53a00848ac1d777f0125 Fixes: bug #1167338 --- lib/rpc_backend | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/rpc_backend b/lib/rpc_backend index 1edea15524..3c485e42c7 100644 --- a/lib/rpc_backend +++ b/lib/rpc_backend @@ -21,9 +21,22 @@ set +o xtrace # Functions # --------- + # Make sure we only have one rpc backend enabled. # Also check the specified rpc backend is available on your platform. function check_rpc_backend() { + local rpc_needed=1 + # We rely on the fact that filenames in lib/* match the service names + # that can be passed as arguments to is_service_enabled. + # We check for a call to iniset_rpc_backend in these files, meaning + # the service needs a backend. + rpc_candidates=$(grep -rl iniset_rpc_backend . | awk -F/ '{print $NF}') + for c in ${rpc_candidates}; do + if is_service_enabled $c; then + rpc_needed=0 + break + fi + done local rpc_backend_cnt=0 for svc in qpid zeromq rabbit; do is_service_enabled $svc && @@ -33,7 +46,7 @@ function check_rpc_backend() { echo "ERROR: only one rpc backend may be enabled," echo " set only one of 'rabbit', 'qpid', 'zeromq'" echo " via ENABLED_SERVICES." - elif [ "$rpc_backend_cnt" == 0 ]; then + elif [ "$rpc_backend_cnt" == 0 ] && [ "$rpc_needed" == 0 ]; then echo "ERROR: at least one rpc backend must be enabled," echo " set one of 'rabbit', 'qpid', 'zeromq'" echo " via ENABLED_SERVICES."