mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
2e2d81b92a
commit
59c5010b6e
@ -91,7 +91,8 @@ die ()
|
||||
# $1 is the tag passed to logger if syslog is in use.
|
||||
script_log()
|
||||
{
|
||||
_tag="$1" ; shift
|
||||
_tag="$1"
|
||||
shift
|
||||
|
||||
case "$CTDB_LOGGING" in
|
||||
file:* | "")
|
||||
@ -263,7 +264,7 @@ ctdb_translate_option ()
|
||||
_variable="$3"
|
||||
|
||||
# ctdb-config already prints an error if something goes wrong
|
||||
_t=$("${CTDB_HELPER_BINDIR}/ctdb-config" get "$_section" "$_opt") || \
|
||||
_t=$("${CTDB_HELPER_BINDIR}/ctdb-config" get "$_section" "$_opt") ||
|
||||
exit $?
|
||||
echo "${_variable}=\"${_t}\""
|
||||
}
|
||||
@ -337,6 +338,7 @@ ctdb_check_directories_probe()
|
||||
;;
|
||||
*)
|
||||
[ -d "${d}/." ] || return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@ -457,7 +459,7 @@ kill_tcp_connections ()
|
||||
else
|
||||
_debuglevel="$CTDB_DEBUGLEVEL"
|
||||
fi
|
||||
echo "$_connections" | \
|
||||
echo "$_connections" |
|
||||
CTDB_DEBUGLEVEL="$_debuglevel" \
|
||||
"${CTDB_HELPER_BINDIR}/ctdb_killtcp" "$_iface" || {
|
||||
echo "Failed to kill TCP connections"
|
||||
@ -499,7 +501,7 @@ tickle_tcp_connections ()
|
||||
_ip="$1"
|
||||
|
||||
# Get connections, both directions
|
||||
_conns=$(get_tcp_connections_for_ip "$_ip" | \
|
||||
_conns=$(get_tcp_connections_for_ip "$_ip" |
|
||||
awk '{ print $1, $2 ; print $2, $1 }')
|
||||
|
||||
echo "$_conns" | awk '{ print "Tickle TCP connection", $1, $2 }'
|
||||
@ -522,7 +524,7 @@ add_ip_to_iface ()
|
||||
_maskbits=$3
|
||||
|
||||
# Ensure interface is up
|
||||
ip link set "$_iface" up || \
|
||||
ip link set "$_iface" up ||
|
||||
die "Failed to bringup interface $_iface"
|
||||
|
||||
# Only need to define broadcast for IPv4
|
||||
@ -590,7 +592,7 @@ ip_maskbits_iface ()
|
||||
*:*) _bits=128 ;;
|
||||
*) _bits=32 ;;
|
||||
esac
|
||||
ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
|
||||
ip addr show to "${_addr}/${_bits}" 2>/dev/null |
|
||||
awk 'NR == 1 { iface = $2; sub(":$", "", iface) ;
|
||||
sub("@.*", "", iface) }
|
||||
$1 ~ /inet/ { mask = $2; sub(".*/", "", mask);
|
||||
@ -654,7 +656,6 @@ interface_monitor ()
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# If the interface is a virtual one (e.g. VLAN) then get the
|
||||
# underlying interface.
|
||||
_realiface=$(interface_get_real "${_iface_info%% *}")
|
||||
@ -729,18 +730,21 @@ _ctdb_counter_common ()
|
||||
}
|
||||
# Some code passes an argument
|
||||
# shellcheck disable=SC2120
|
||||
ctdb_counter_init () {
|
||||
ctdb_counter_init()
|
||||
{
|
||||
_ctdb_counter_common "$1"
|
||||
|
||||
: >"$_counter_file"
|
||||
}
|
||||
ctdb_counter_incr () {
|
||||
ctdb_counter_incr()
|
||||
{
|
||||
_ctdb_counter_common "$1"
|
||||
|
||||
# unary counting using newlines!
|
||||
echo >>"$_counter_file"
|
||||
}
|
||||
ctdb_counter_get () {
|
||||
ctdb_counter_get()
|
||||
{
|
||||
_ctdb_counter_common "$1"
|
||||
# unary counting!
|
||||
_val=$(wc -c <"$_counter_file" 2>/dev/null || echo 0)
|
||||
@ -762,7 +766,7 @@ ctdb_setup_state_dir ()
|
||||
|
||||
script_state_dir="${CTDB_SCRIPT_VARDIR}/${_type}/${_name}"
|
||||
|
||||
mkdir -p "$script_state_dir" || \
|
||||
mkdir -p "$script_state_dir" ||
|
||||
die "Error creating script state dir \"${script_state_dir}\""
|
||||
}
|
||||
|
||||
@ -836,7 +840,8 @@ ctdb_standard_event_handler ()
|
||||
|
||||
iptables_wrapper()
|
||||
{
|
||||
_family="$1" ; shift
|
||||
_family="$1"
|
||||
shift
|
||||
if [ "$_family" = "inet6" ]; then
|
||||
_iptables_cmd="ip6tables"
|
||||
else
|
||||
@ -859,8 +864,8 @@ if ! type mktemp >/dev/null 2>&1 ; then
|
||||
shift
|
||||
fi
|
||||
_d="${TMPDIR:-/tmp}"
|
||||
_hex10=$(dd if=/dev/urandom count=20 2>/dev/null | \
|
||||
cksum | \
|
||||
_hex10=$(dd if=/dev/urandom count=20 2>/dev/null |
|
||||
cksum |
|
||||
awk '{print $1}')
|
||||
_t="${_d}/tmp.${_hex10}"
|
||||
(
|
||||
@ -934,7 +939,7 @@ nfs_callout ()
|
||||
fi
|
||||
|
||||
# Run the operation if it is registered...
|
||||
if [ -e "${nfs_callout_cache_ops}/${1}" ] || \
|
||||
if [ -e "${nfs_callout_cache_ops}/${1}" ] ||
|
||||
[ -e "${nfs_callout_cache_ops}/ALL" ]; then
|
||||
"$CTDB_NFS_CALLOUT" "$@"
|
||||
fi
|
||||
@ -990,11 +995,11 @@ update_tickles ()
|
||||
sort >"$_my_tickles"
|
||||
|
||||
# Add tickles for connections that we haven't already got tickles for
|
||||
comm -23 "$_my_connections" "$_my_tickles" | \
|
||||
comm -23 "$_my_connections" "$_my_tickles" |
|
||||
$CTDB addtickle
|
||||
|
||||
# Remove tickles for connections that are no longer there
|
||||
comm -13 "$_my_connections" "$_my_tickles" | \
|
||||
comm -13 "$_my_connections" "$_my_tickles" |
|
||||
$CTDB deltickle
|
||||
|
||||
rm -f "$_my_connections" "$_my_tickles"
|
||||
|
Loading…
x
Reference in New Issue
Block a user