IMPALA-6837: allow multiple networks for distcc server

Testing:
Tested the script on Ubuntu 14.04 and CentOS 6 servers to confirm
that it resulted in a working configuration.

Change-Id: I6d49786b4f6e9c3bfab244e63620a62b2ae4dd64
Reviewed-on: http://gerrit.cloudera.org:8080/10029
Reviewed-by: Philip Zeyliger <phi...@cloudera.com>
Tested-by: Tim Armstrong <tarmstr...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/e94dfe47
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/e94dfe47
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/e94dfe47

Branch: refs/heads/2.x
Commit: e94dfe477d1e23ed754d27130a46a46023f46f60
Parents: 22750d4
Author: Tim Armstrong <tarmstr...@cloudera.com>
Authored: Wed Apr 11 17:30:39 2018 -0700
Committer: Impala Public Jenkins <impala-public-jenk...@gerrit.cloudera.org>
Committed: Fri Apr 13 03:26:26 2018 +0000

----------------------------------------------------------------------
 bin/distcc/distcc_server_setup.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/e94dfe47/bin/distcc/distcc_server_setup.sh
----------------------------------------------------------------------
diff --git a/bin/distcc/distcc_server_setup.sh 
b/bin/distcc/distcc_server_setup.sh
index 893a82d..8b5e6a9 100755
--- a/bin/distcc/distcc_server_setup.sh
+++ b/bin/distcc/distcc_server_setup.sh
@@ -30,6 +30,10 @@
 #
 #   sudo ./bin/distcc/distcc_server_setup.sh 172.16.0.0/12
 #
+# Multiple networks can be allowed by providing a space-separated list:
+#
+#   sudo ./bin/distcc/distcc_server_setup.sh "172.16.0.0/12 10.16.0.0/8"
+#
 # Environment overrides:
 # ---------------------
 # CCACHE_DIR: directory to use for distccd's ccache.
@@ -97,9 +101,13 @@ export CCACHE_DIR=${CCACHE_DIR}
 # END: Settings automatically generated by distcc_server_setup.sh
 EOF
 else
+  ALLOWED_NETS_ARGS=
+  for allowed_net in $ALLOWED_NETS; do
+    ALLOWED_NETS_ARGS+=" --allow ${allowed_net}"
+  done
   cat << EOF >> /etc/sysconfig/distccd
 # BEGIN: Settings automatically generated by distcc_server_setup.sh
-OPTIONS="--jobs $(($(nproc) * 2)) --allow ${ALLOWED_NETS} --log-level=warn 
--nice=-15"
+OPTIONS="--jobs $(($(nproc) * 2)) ${ALLOWED_NETS_ARGS} --log-level=warn 
--nice=-15"
 # CCACHE_DIR is picked up by ccache from environment. CentOS 6 requires 
CCACHE_DIR to
 # be exported while CentOS 7 seems to ignore the "export VAR=val" syntax.
 CCACHE_DIR=${CCACHE_DIR}

Reply via email to