Please join https://ardc.groups.io/g/wiki and share thoughts there.

On Thu, Feb 1, 2024 at 11:53 AM Andreas Ott via 44net <44net@mailman.ampr.org> wrote:
Somehow the output of the API call must have changed over time. It now includes a count value before the encap array data, which will lead to an error when processing it with jq.

Please update wiki the page with a different jq filter, c.f. how I fixed the script on our system. I am ignoring the count value.

root@host:~# diff -U1 get-encap.sh-orig get-encap.sh

--- get-encap.sh-orig   2024-02-01 11:24:31.725642496 -0800

+++ get-encap.sh        2024-02-01 11:24:53.421227002 -0800

@@ -24,3 +24,3 @@

 curl -s https://user:key@portal.ampr.org/api/v1/encap > json-data.out

-cat json-data.out |  jq -r '.[] | "route addprivate \(.network)/\(.maskLength) encap \(.gatewayIP)"' >> encap.txt

+cat json-data.out |  jq -r '.encap[] | "route addprivate \(.network)/\(.maskLength) encap \(.gatewayIP)"' >> encap.txt

root@host:~#


Thanks, andreas K6OTT
_______________________________________________
44net mailing list -- 44net@mailman.ampr.org
To unsubscribe send an email to 44net-leave@mailman.ampr.org


--
John D. Hays
Kingston, WA
K7VE / WRJT-215