1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ctdb-scripts: Move ctdb_get_ip_address() to functions file

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-04-08 15:53:47 +10:00 committed by Amitay Isaacs
parent 0352224262
commit b7376861cb
2 changed files with 13 additions and 13 deletions

View File

@ -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

View File

@ -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