commit 058a4859da95465879a53bd9716bffe9eca59f5c
parent 435fbf81dc45167c89b5a9f60a47140ed89008a4
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 15 Apr 2025 09:29:48 +0200
adjust jq converter to latest Sebastian renames
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/roles/challenger/files/usr/local/bin/jq-postal-converter b/roles/challenger/files/usr/local/bin/jq-postal-converter
@@ -9,15 +9,16 @@
# the "ADDRESS_*" fields.
#
# Uses JQ to convert!
-exec jq 'if .address_type!="postal" then halt_error(4) else (. | .id?) |= (. | tostring) | .PERSON_FULL_NAME=.address.full_name | ADDRESS_STREET=.address.street | ADDRESS_TOWN_LOCATION=.address.city | ADDRESS_ZIPCODE=.address.postcode | ADDRESS_COUNTRY_CC=.address.country | del(.address) | del(.address_type) end'
+exec jq 'if .address_type!="postal" and .address_type !="postal-ch" then halt_error(4) else (. | .id?) |= (. | tostring) | .CONTACT_NAME=.address.CONTACT_NAME | .ADDRESS_LINES=.address.ADDRESS_LINES | if .address_type=="postal" then .ADDRESS_COUNTRY=.address.ADDRESS_COUNTRY else .ADDRESS_COUNTRY="CH" end | del(.address) | del(.address_type) end'
# Example input:
# {
# "id": 1,
# "address": {
-# "XXX": "me@example.com"
+# "CONTACT_NAME": "Richard Stallman",
+# "ADDRESS_LINES": "Bundesgasse 1\n1234 Bern"
# },
-# "address_type": "postal",
+# "address_type": "postal-ch",
# "expires": {
# "t_s": 1775590216
# }
@@ -30,10 +31,8 @@ exec jq 'if .address_type!="postal" then halt_error(4) else (. | .id?) |= (. | t
# "expires": {
# "t_s": 1775590216
# }
-# "PERSON_FULL_NAME": "Richard Stallman"
-# "ADDRESS_STREET": "Bundesgasse 1"
-# "ADDRESS_TOWN_LOCATION": "Bern"
-# "ADDRESS_ZIPCODE": "1234"
+# "CONTACT_NAME": "Richard Stallman"
+# "ADDRESS_LIENS": "Bundesgasse 1\n1234 Bern"
# "ADDRESS_COUNTRY_CC": "CH"
# }
#