beautysh: re-format
beautysh is enabled in the openbmc-build-scripts on Bash/Zsh/POSIX-sh
files to have a consistent formatting. Re-run the formatter on the
whole repository.
Change-Id: I6a61656dd6033329cba124ac0754152cbd1e9de3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/subprojects/ncsid/src/update_static_neighbors.sh b/subprojects/ncsid/src/update_static_neighbors.sh
index 8a6c72f..2f46f82 100644
--- a/subprojects/ncsid/src/update_static_neighbors.sh
+++ b/subprojects/ncsid/src/update_static_neighbors.sh
@@ -15,48 +15,48 @@
source "$(dirname "${BASH_SOURCE[0]}")"/ncsid_lib.sh
-UpdateNeighbor() {
- local netdev="$1"
- local service="$2"
- local object="$3"
+function UpdateNeighbor() {
+ local netdev="$1"
+ local service="$2"
+ local object="$3"
- eval "$(GetNeighbor "$service" "$object" | JSONToVars)" || return $?
- local new_mac
- if ! new_mac="$(DetermineNeighbor "$netdev" "$IPAddress")"; then
- echo "Faild to find $IPAddress" >&2
- return 10
- fi
- new_mac=$(normalize_mac "$new_mac") || return
- if [ "$new_mac" != "$(normalize_mac "$MACAddress")" ]; then
- echo "Updating $IPAddress: $MACAddress -> $new_mac" >&2
- SuppressTerm
- local rc=0
- DeleteObject "$service" "$object" && \
- AddNeighbor "$service" "$netdev" "$IPAddress" "$new_mac" || \
- rc=$?
- UnsuppressTerm
- return $rc
- fi
+ eval "$(GetNeighbor "$service" "$object" | JSONToVars)" || return $?
+ local new_mac
+ if ! new_mac="$(DetermineNeighbor "$netdev" "$IPAddress")"; then
+ echo "Faild to find $IPAddress" >&2
+ return 10
+ fi
+ new_mac=$(normalize_mac "$new_mac") || return
+ if [ "$new_mac" != "$(normalize_mac "$MACAddress")" ]; then
+ echo "Updating $IPAddress: $MACAddress -> $new_mac" >&2
+ SuppressTerm
+ local rc=0
+ DeleteObject "$service" "$object" && \
+ AddNeighbor "$service" "$netdev" "$IPAddress" "$new_mac" || \
+ rc=$?
+ UnsuppressTerm
+ return $rc
+ fi
}
-UpdateNeighbors() {
- local netdev="$1"
+function UpdateNeighbors() {
+ local netdev="$1"
- local entry
- while read entry; do
- eval "$(echo "$entry" | JSONToVars)"
- RunInterruptibleBg UpdateNeighbor "$netdev" "$service" "$object"
- done < <(GetNeighborObjects "$netdev" 2>/dev/null)
- WaitInterruptibleBg
+ local entry
+ while read entry; do
+ eval "$(echo "$entry" | JSONToVars)"
+ RunInterruptibleBg UpdateNeighbor "$netdev" "$service" "$object"
+ done < <(GetNeighborObjects "$netdev" 2>/dev/null)
+ WaitInterruptibleBg
}
-Main() {
- set -o nounset
- set -o errexit
- set -o pipefail
+function Main() {
+ set -o nounset
+ set -o errexit
+ set -o pipefail
- InitTerm
- UpdateNeighbors "$@"
+ InitTerm
+ UpdateNeighbors "$@"
}
return 0 2>/dev/null