fix: make PikaOA edge apply idempotent
This commit is contained in:
@@ -236,10 +236,12 @@ if changed:
|
||||
print(json.dumps({"ok": True, "service": service, "fromPort": old, "toPort": new, "changed": changed}))
|
||||
PY
|
||||
port_rc=$?
|
||||
if [ "$port_rc" -eq 0 ]; then
|
||||
if [ "$port_rc" -eq 0 ] && grep -q '"changed": true' "$tmp/port.json"; then
|
||||
cd ${shQuote(spec.tcpPortRelease.workDir)}
|
||||
${spec.tcpPortRelease.applyCommand} >"$tmp/vpn.out" 2>"$tmp/vpn.err"
|
||||
vpn_rc=$?
|
||||
elif [ "$port_rc" -eq 0 ]; then
|
||||
: >"$tmp/vpn.out"; : >"$tmp/vpn.err"; vpn_rc=0
|
||||
else
|
||||
: >"$tmp/vpn.out"; : >"$tmp/vpn.err"; vpn_rc=1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user