brianreumere / gandi-automatic-dns

Dynamic DNS shell script for Gandi
Other
100 stars 22 forks source link

Gandi API emergency change #16

Closed CMSplumbear closed 7 years ago

CMSplumbear commented 7 years ago

Gandi has changed the id parameter from int to string and that's used by gad https://news.gandi.net/en/2017/08/incident-report-concerning-public-api/ http://doc.rpc.gandi.net/domain/reference.html?zone.record.list#ZoneRecordReturn

The simple patch below seems to work (hoping I didn't overlook something)

Thanks

--- gad 2017-06-03 22:46:23.000000000 +0200
+++ gad-new     2017-08-02 19:02:35.866126370 +0200
@@ -136,3 +136,3 @@
   while [ ! -z "$1" ]; do
-    new_record_id=`rpc "domain.zone.record.list" "int" "$zone_id" "int" "$new_version_id" "struct" "name" "string" "$1" "type" "string" "$record_type" | grep -A 1 ">id<" | sed -n 's/.*<int>\([0-9]*\).*/\1/p'`
+    new_record_id=`rpc "domain.zone.record.list" "string" "$zone_id" "int" "$new_version_id" "struct" "name" "string" "$1" "type" "string" "$record_type" | grep -A 1 ">id<" | sed -n 's/.*<int>\([0-9]*\).*/\1/p'`
     if [ "$debug" = "yes" ]; then
@@ -140,3 +140,3 @@
     fi
-    rpc "domain.zone.record.update" "int" "$zone_id" "int" "$new_version_id" "struct" "id" "int" "$new_record_id" "struct" "name" "string" "$1" "type" "string" "$record_type" "value" "string" "$ext_ip"
+    rpc "domain.zone.record.update" "string" "$zone_id" "int" "$new_version_id" "struct" "id" "int" "$new_record_id" "struct" "name" "string" "$1" "type" "string" "$record_type" "value" "string" "$ext_ip"
     shift
@@ -154,3 +154,3 @@
   while [ ! -z "$1" ]; do
-    record_value=`rpc "domain.zone.record.list" "int" "$zone_id" "int" "0" "struct" "name" "string" "$1" "type" "string" "$record_type" | grep -A 1 ">value<" | sed -n "s/.*<string>"$ip_regex".*/\1/p"`
+    record_value=`rpc "domain.zone.record.list" "string" "$zone_id" "int" "0" "struct" "name" "string" "$1" "type" "string" "$record_type" | grep -A 1 ">value<" | sed -n "s/.*<string>"$ip_regex".*/\1/p"`
     record_count=`printf "$record_value" | wc -w`
brianreumere commented 7 years ago

Should be fixed in 214012f! Thanks for reporting this and for the fix.