From: Martin Schwenke Date: Fri, 8 Apr 2016 05:53:47 +0000 (+1000) Subject: ctdb-scripts: Move ctdb_get_ip_address() to functions file X-Git-Tag: talloc-2.1.7~250 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7376861cbbcdddff9764f622f8c0bc9526b6690;p=thirdparty%2Fsamba.git ctdb-scripts: Move ctdb_get_ip_address() to functions file Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw index 25cf27fa202..bc00788e7b7 100755 --- a/ctdb/config/events.d/11.natgw +++ b/ctdb/config/events.d/11.natgw @@ -23,19 +23,6 @@ natgw_cfg_new="${service_state_dir}/cfg_new" natgw_cfg_old="${service_state_dir}/cfg_old" natgw_master_old="${service_state_dir}/master_old" -# Cached retrieval of private IP address from local node. This never -# changes. Sets $ip_address to avoid an unnecessary subprocess. -ctdb_get_ip_address () -{ - _ip_addr_file="${service_state_dir}/my-ip-address" - if [ ! -f "$_ip_addr_file" ] ; then - ctdb -X nodestatus | - awk -F '|' 'NR == 2 { print $3 }' >"$_ip_addr_file" - fi - - read ip_address <"$_ip_addr_file" -} - ctdb_natgw_slave_only () { ctdb_get_ip_address diff --git a/ctdb/config/functions b/ctdb/config/functions index 8d3e3447215..782978dad84 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -247,6 +247,19 @@ ctdb_get_pnn () read pnn <"$_pnn_file" } +# Cached retrieval of private IP address from local node. This never +# changes. Sets $ip_address to avoid an unnecessary subprocess. +ctdb_get_ip_address () +{ + _ip_addr_file="${CTDB_SCRIPT_VARDIR}/my-ip-address" + if [ ! -f "$_ip_addr_file" ] ; then + ctdb -X nodestatus | + awk -F '|' 'NR == 2 { print $3 }' >"$_ip_addr_file" + fi + + read ip_address <"$_ip_addr_file" +} + ###################################################### # wrapper around /proc/ settings to allow them to be hooked # for testing