Browse code

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

Matthieu Huin authored on 2013/04/16 00:13:41
Showing 1 changed files
... ...
@@ -21,9 +21,22 @@ set +o xtrace
21 21
 # Functions
22 22
 # ---------
23 23
 
24
+
24 25
 # Make sure we only have one rpc backend enabled.
25 26
 # Also check the specified rpc backend is available on your platform.
26 27
 function check_rpc_backend() {
28
+    local rpc_needed=1
29
+    # We rely on the fact that filenames in lib/* match the service names
30
+    # that can be passed as arguments to is_service_enabled.
31
+    # We check for a call to iniset_rpc_backend in these files, meaning
32
+    # the service needs a backend.
33
+    rpc_candidates=$(grep -rl iniset_rpc_backend . | awk -F/ '{print $NF}')
34
+    for c in ${rpc_candidates}; do
35
+        if is_service_enabled $c; then
36
+            rpc_needed=0
37
+            break
38
+        fi
39
+    done
27 40
     local rpc_backend_cnt=0
28 41
     for svc in qpid zeromq rabbit; do
29 42
         is_service_enabled $svc &&
... ...
@@ -33,7 +46,7 @@ function check_rpc_backend() {
33 33
         echo "ERROR: only one rpc backend may be enabled,"
34 34
         echo "       set only one of 'rabbit', 'qpid', 'zeromq'"
35 35
         echo "       via ENABLED_SERVICES."
36
-    elif [ "$rpc_backend_cnt" == 0 ]; then
36
+    elif [ "$rpc_backend_cnt" == 0 ] && [ "$rpc_needed" == 0 ]; then
37 37
         echo "ERROR: at least one rpc backend must be enabled,"
38 38
         echo "       set one of 'rabbit', 'qpid', 'zeromq'"
39 39
         echo "       via ENABLED_SERVICES."