Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jq v1.5 creates dupblicate A-records #29

Open
fajabird opened this issue Dec 9, 2022 · 4 comments
Open

jq v1.5 creates dupblicate A-records #29

fajabird opened this issue Dec 9, 2022 · 4 comments

Comments

@fajabird
Copy link

fajabird commented Dec 9, 2022

I'm running the script on a ubuntu server LTS 18.04 which only has jq version 1.5-1-a5b5cbe.

  1. when I run the script I get following output which is very strange because a) it shows that the script does find the jq command but still I get:

root@server1:/usr/local/bin# ./dyndns.sh
Info: Record_Name: server1 : Zone_ID:
Info: Record_Name: server1 : Zone_Name:
Info: Record_Name: server1 : Using IPv4, because A was set as record type.
Info: Record_Name: server1 : Current public IP address:
jq - commandline JSON processor [version 1.5-1-a5b5cbe]
Usage: jq [options] [file...]

jq is a tool for processing JSON inputs, applying the
given filter to its JSON text inputs and producing the
filter's results as JSON on standard output.
The simplest filter is ., which is the identity filter,
copying jq's input to its output unmodified (except for
formatting).
For more advanced filters see the jq(1) manpage ("man jq")
and/or https://stedolan.github.io/jq

Some of the options include:
 -c		compact instead of pretty-printed output;
 -n		use `null` as the single input value;
 -e		set the exit status code based on the output;
 -s		read (slurp) all inputs into an array; apply filter to it;
 -r		output raw strings, not JSON texts;
 -R		read raw strings, not JSON texts;
 -C		colorize JSON;
 -M		monochrome (don't colorize JSON);
 -S		sort keys of objects on output;
 --tab	use tabs for indentation;
 --arg a v	set variable $a to value <v>;
 --argjson a v	set variable $a to JSON value <v>;
 --slurpfile a f	set variable $a to an array of JSON texts read from <f>;
See the manpage for more options.

Info: Record_Name: : Record_ID:
DNS record "" does not exists - will be created.
{"record":{"id":"","type":"","name":"","value":"","zone_id":"","created":"","modified":""},"error":{"message":"422 Unprocessable Entity: taken: ; ","code":422}}

I guess the last line means that some part of the input cannot be processed by that jq version? Is there a workaround that will work with this version?

@dr4hcu5-jan
Copy link

To me it seems like you are neither supplying a zone name nor a zone ID. Furthermore, it seems like you are not setting a record name (e.g. @, *). Therefore the JSON generated may be wrong.

The last line means that the Hetzner API rejected your request since there is information missing in the request, but the request is not malformed. See the MDN page here.

@tho22
Copy link

tho22 commented Feb 10, 2023

I had the same problem.
You must use the JQ V1.6.
I simply replaced the binary in my environment with the current JQ:
https://stedolan.github.io/jq/download/

@magoralczyk
Copy link

I can also confirm that. It is a little weird to replace the original 22kb file with a 4MB file, but it worked like tho22 described.

@thcrt
Copy link
Contributor

thcrt commented Dec 16, 2023

Running ./dyndns.sh without any arguments will always fail. It needs a zone and a record to be specified. Zones may be specified with either ID or name, while records may be specified with either or both.

Perhaps this still would not have worked if you had passed the correct arguments, but the given example would not have worked anyway. I'm also confused as to why the issue is titled referencing 'duplicate A records' but you don't mention anything about that in the issue itself. Maybe this has since been fixed by #30?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants