Richard Hansen
bbf98dd031
Use parse_assignments
to process --options
...
This simplifies the code and enables quoting of special characters.
2024-08-18 00:41:28 -04:00
Richard Hansen
270a82dd58
parse_assignments: Support newlines
...
Allow newlines to be in values, but stop searching for assignments
once an unescaped/unquoted newline is discovered. This is preparation
to using `parse_assignments` to process the `--options` command-line
argument, which might have embedded newlines.
2024-08-18 00:41:28 -04:00
Richard Hansen
4c7634855b
Move *_env
processing to parse_assignment
...
This makes the behavior transparent to the rest of ddclient, which
will make it possible for a future commit to simplify option
processing.
2024-08-18 00:41:28 -04:00
Richard Hansen
19848852a4
check_value: Mention supported values if given an invalid value
2024-08-18 00:41:28 -04:00
Richard Hansen
ed2afde72d
check_value: die
if the value is invalid
...
This makes it possible to convey details about why the value was
deemed invalid. It also allows `undef` to be treated as a valid
value.
2024-08-18 00:41:28 -04:00
Richard Hansen
2f8a4ba00a
Use opt()
instead of accessing %opt
or %globals
directly
...
This is for consistency, and to ensure that all possible ways of
configuring are respected.
2024-08-18 00:41:28 -04:00
Richard Hansen
4d3dcdc7de
Move option normalization from usage to load
...
This avoids bugs if a usage forgets to normalize the value.
2024-08-18 00:41:28 -04:00
Richard Hansen
70858e659f
Also warn about non-required values that are invalid
...
Before, only required values that were invalid produced a warning.
Non-required values were quietly ignored.
2024-08-18 00:41:28 -04:00
Richard Hansen
05dbe7a984
Delete confusing and unnecessary T_OFQDN
type
...
Variable declarations already have a `required` flag, which makes the
type confusing. What would it mean for a variable to be a required
`T_OFQDN`? And how would an optional `T_FQDN` differ from an optional
`T_OFQDN`?
2024-08-18 00:41:28 -04:00
Richard Hansen
9e659a18eb
Move --help
processing to %opt
2024-08-18 00:41:28 -04:00
Richard Hansen
c83dc67039
Remove pointless help
setting
...
This does not affect the `--help` command-line argument.
The `help` setting didn't do anything useful, and it didn't make sense
to set `help=1` in the config file (or pass `--options=help=1`), so
this removal is unlikely to affect anyone. If the setting does exist,
the user will get a warning and the setting will be ignored.
2024-08-18 00:41:28 -04:00
Richard Hansen
b4c4b5dc54
Move usage generation to a separate function
2024-08-18 00:41:28 -04:00
Richard Hansen
bd688e9750
Add TODO comments for problematic bits of code
2024-08-18 00:41:28 -04:00
Richard Hansen
ab2e0d7999
hetzner: Quote interpolated value in regex
...
to prevent metacharacter issues.
2024-08-18 00:41:28 -04:00
Richard Hansen
0b79e3bc95
godaddy: Delete redundant condition
2024-08-18 00:41:27 -04:00
Jeff Rego
959b5ddc37
Add support for Directnic provider
2024-08-07 00:06:25 -04:00
Jeff Rego
d497422bf9
Add T_URL type for config properties
2024-08-07 00:06:25 -04:00
Tamás
e4d43f0292
Removed min-interval from changeip protocol
...
Removed the min-interval set to 5 minutes in changeip, because according to my tests, changeip has no problem updating every 30 seconds, which is the default min-interval value in ddclient
2024-08-03 11:11:16 +03:00
Richard Hansen
3d345ff08b
dyndns2: Add tests
2024-08-03 03:32:35 -04:00
Richard Hansen
622abfca2c
repr: New utility function to make it easier to dump values
...
I find Data::Dumper to be awkward to use. This function wraps it so
that I don't have to keep looking up the perldoc.
2024-08-03 03:25:11 -04:00
Richard Hansen
4f369a3b0b
geturl: Simplify headers logic
2024-08-03 03:25:11 -04:00
Richard Hansen
2239b57101
dyndns2: Fix handling of multi-host response
2024-08-03 03:25:11 -04:00
Richard Hansen
7bee2d7c82
dyndns2: Log message improvements
2024-08-03 03:17:52 -04:00
Richard Hansen
143630c7fd
dyndns2: Delete rogue comma
2024-08-03 03:17:52 -04:00
Richard Hansen
a99d093eca
dyndns2: Whitespace fixes
2024-08-03 03:17:52 -04:00
Richard Hansen
43ea691e0c
Logger: Move log output to parentmost Logger
...
This makes it possible for tests to redirect log output so that they
can ensure that certain log messages are generated.
2024-08-02 21:37:14 -04:00
Richard Hansen
f4248d0617
Logger: Separate implementation from interface
...
This makes it easier to override the implementation for testing
purposes.
2024-08-02 21:14:37 -04:00
Richard Hansen
56f8c83d3a
Logger: Check label
for emptiness, not truthiness
2024-08-02 21:05:42 -04:00
Richard Hansen
0f094ac121
Logger: Check msg
and label
for definedness
2024-08-02 21:05:41 -04:00
Richard Hansen
15db76f739
Logger: Accept an arrayref of contexts for ctx
parameter
2024-08-02 20:42:36 -04:00
Richard Hansen
f36c2f45aa
Logger: Always use STDERR as output filehandle
...
There's no good reason for the caller of the `log` method to control
the output filehandle.
2024-08-02 17:03:56 -04:00
Richard Hansen
37504fe6f2
Logger: Document the log
method
2024-08-02 16:13:56 -04:00
Richard Hansen
1bdd65e46e
Delete unused encode_base64
function
2024-08-02 16:13:56 -04:00
Richard Hansen
e036fd0cf6
logging: Use Logger contexts to improve log message readability
...
This also makes it easier to write useful log messages.
2024-07-31 01:01:00 -04:00
Richard Hansen
9e45aecf20
logging: New Logger class to generally handle context prefixes
2024-07-31 00:39:48 -04:00
Richard Hansen
23bc8cdac3
logging: Move colon from the label to logmsg
2024-07-31 00:39:48 -04:00
Richard Hansen
3262dd0952
logging: Rename pfx
to label
...
This is to prepare for a general log prefix mechanism to improve log
readability.
2024-07-31 00:39:48 -04:00
Richard Hansen
015600d72f
logging: Delete unused debug2
function
2024-07-31 00:39:47 -04:00
Richard Hansen
42d635c2df
dinahosting: Fix missing argument for log message format specifier
...
Also use string interpolation for readability and to reduce the
chances of reintroducing a bug like this in the future.
2024-07-31 00:39:47 -04:00
Richard Hansen
706ba713e0
porkbun: Fix IP version in success log message
...
Fixes a bug introduced in commit:
d8a23ff9a4
2024-07-31 00:39:47 -04:00
Richard Hansen
f5c59c2024
nsupdate: Log success/failure once for all hosts
2024-07-31 00:39:47 -04:00
Richard Hansen
0c2c97123f
namecheap: Log message improvements
2024-07-31 00:39:47 -04:00
Richard Hansen
71dc1f92e4
zoneedit1: Fix logged host names
2024-07-31 00:39:47 -04:00
Richard Hansen
9c5160a514
Whitespace fixes
2024-07-30 02:25:05 -04:00
Richard Hansen
5620127c71
Delete unnecessary comments
2024-07-30 02:24:27 -04:00
Richard Hansen
96ada0c79e
inwx: Add comment explaining why hostnames are not in update URL
2024-07-29 23:45:55 -04:00
Richard Hansen
d380e17aba
infomaniak: Fix response status processing
...
Previously, `nochg` responses were treated as failures and the logged
message for all responses was incorrect (either `undef` or "Unknown
reply from Infomaniak").
Background: Hash values are always scalars, so lists of values can
only be stored in hashes in arrayref form.
The following is legal but does not do what one might expect:
my %h = (
a => (1, 2),
b => (3, 4),
);
The `=>` operator is just a variant of the comma operator, and lists
in list context are flattened, so the above is equivalent to:
my %h = ('a', 1, 2, 'b', 3, 4);
which is equivalent to:
my %h = (
a => 1,
2 => 'b',
3 => 4,
);
which is obviously not what was intended.
2024-07-29 04:07:15 -04:00
Richard Hansen
3f0fd0f37b
infomaniak: Use variable interpolation instead of sprintf
...
for readability.
2024-07-29 04:02:42 -04:00
Richard Hansen
bb65b64e39
infomaniak: Whitespace fixes
2024-07-29 04:02:42 -04:00
Richard Hansen
0b30df4b69
gandi: Fix processing of PUT
error responses
...
Before, the returned JSON wasn't even parsed -- the error handling
code was reusing the parsed response from the earlier `GET`. Also, it
was reading object properties that were not documented in the Gandi
API documentation.
2024-07-28 19:04:30 -04:00
Richard Hansen
06c3dd5825
gandi: Invert condition to improve readability
2024-07-28 18:24:19 -04:00
Richard Hansen
6f505e6538
gandi: Inline an unnecessary variable
2024-07-28 18:24:19 -04:00
Richard Hansen
5e52f728ad
gandi: Use an array for headers for readability
2024-07-28 18:24:19 -04:00
Richard Hansen
a890b08935
gandi: Check for JSON object, not just definedness
2024-07-28 18:24:19 -04:00
Richard Hansen
b1ddaa0ce8
gandi: Log message improvements
2024-07-28 18:24:19 -04:00
Richard Hansen
12d5539abc
gandi: Don't ignore HTTP response code
2024-07-28 18:24:19 -04:00
Richard Hansen
325eb10536
gandi: Style fixes for readability
2024-07-28 18:24:19 -04:00
Richard Hansen
2ccdefff93
gandi: Whitespace fixes
2024-07-28 18:24:19 -04:00
Richard Hansen
15595d01ac
gandi: Delete unnecessary comment
2024-07-28 18:24:19 -04:00
Richard Hansen
0fa7e132b1
logging: Delete now-unused verbose
function
2024-07-28 17:52:42 -04:00
Richard Hansen
54d381a18e
nsupdate: Convert some verbase
log messages to debug
2024-07-28 17:52:42 -04:00
Richard Hansen
61cc5d66ae
logging: Delete unnecessary verbose
calls
...
The same information (or more) is logged in the previous line.
2024-07-28 17:48:58 -04:00
Richard Hansen
ee0940175e
Delete redundant calls to failed
...
`header_ok` already calls `failed` if there's an error.
2024-07-28 03:45:10 -04:00
Richard Hansen
f410b915ce
Delete redundant checks
...
`header_ok` already asserts that the reply is defined and non-empty.
2024-07-28 03:45:10 -04:00
Richard Hansen
fc453a0de3
porkbun: Check for JSON object, not just non-null
2024-07-27 04:40:34 -04:00
Richard Hansen
536c7c87a2
porkbun: Invert condition to improve readability
2024-07-27 04:40:34 -04:00
Richard Hansen
d8a23ff9a4
porkbun: Improve log messages
2024-07-27 04:40:34 -04:00
Richard Hansen
e1c8b26f7b
porkbun: Simplify string equality check
2024-07-27 04:40:34 -04:00
Richard Hansen
0c31681d35
porkbun: Simplify array length check
2024-07-27 04:40:34 -04:00
Richard Hansen
16b15ea089
porkbun: Remove headers from HTTP response before processing
2024-07-27 04:40:34 -04:00
Richard Hansen
c65d5c1254
porkbun: Don't bother setting status
on failure
...
It's already initialized to a non-success value.
2024-07-27 04:40:34 -04:00
Richard Hansen
bafd5a8715
porkbun: Inline unnecessary variables
2024-07-27 04:40:34 -04:00
Richard Hansen
45d832145f
porkbun: Simplify RR set type
2024-07-27 04:40:34 -04:00
Richard Hansen
038b31cf77
porkbun: Simplify zone removal logic
2024-07-27 04:40:34 -04:00
Richard Hansen
630a2d5d49
porkbun: Move "ipv" out of $ipv
for consistency
...
This also makes it possible to change "ipv4" and "ipv6" in log
messages to "IPv4" and "IPv6".
2024-07-27 04:40:34 -04:00
Richard Hansen
4273580bdf
porkbun: Consolidate lines to improve readability
2024-07-27 04:40:34 -04:00
Richard Hansen
c6bcfd4644
porkbun: Quote interpolated variable in regex
2024-07-27 04:40:34 -04:00
Richard Hansen
1020145fdf
porkbun: Rename variables for brevity and consistency
2024-07-27 04:40:34 -04:00
Richard Hansen
3f740c3e19
porkbun: Whitespace fixes
2024-07-27 04:40:34 -04:00
Richard Hansen
4b5b8ab62d
porkbun: Delete unnecessary comments
2024-07-27 04:40:34 -04:00
Richard Hansen
3dae16457a
dnsmadeeasy: Consolidate lines for readability
2024-07-27 04:40:34 -04:00
Richard Hansen
2eb0398cf2
dnsmadeeasy: Invert condition to improve readability
2024-07-27 04:40:34 -04:00
Richard Hansen
b07aa91ed5
dnsmadeeasy: Don't bother setting status
on failure
...
It's already initialized to a non-success value.
2024-07-27 04:40:34 -04:00
Richard Hansen
971fe438a3
dnsmadeeasy: Convert string literal to compiled regex
...
for readability.
2024-07-27 04:40:34 -04:00
Richard Hansen
ca28694dd7
dnsmadeeasy: Don't assume the result code is known
2024-07-27 04:40:34 -04:00
Richard Hansen
11876498d5
dnsmadeeasy: Improve log messages
2024-07-27 04:40:34 -04:00
Richard Hansen
c79d12263e
dnsmadeeasy: Whitespace fixes
2024-07-27 04:40:34 -04:00
Richard Hansen
07800a4586
dnsmadeeasy: Delete unnecessary comments
2024-07-27 04:40:34 -04:00
Richard Hansen
f42583c0cf
dondominio: Quote interpolated variable in regex
2024-07-27 04:40:34 -04:00
Richard Hansen
6ac5b41a20
dondominio: Invert condition to improve readability
2024-07-27 04:40:34 -04:00
Richard Hansen
d79ef268bd
dondominio: Combine regular expressions to improve readability
2024-07-27 04:40:34 -04:00
Richard Hansen
8b58f7bd99
dondominio: Don't bother setting status
on error
...
It's already initialized to a non-success value.
2024-07-27 04:40:34 -04:00
Richard Hansen
2823e47c58
dondominio: The IP address is always provided
2024-07-27 04:40:34 -04:00
Richard Hansen
fe502abcd8
dondominio: Consolidate lines for readability
2024-07-27 04:40:34 -04:00
Richard Hansen
7a43920b99
dondominio: Improve log messages
2024-07-27 04:40:34 -04:00
Richard Hansen
17a002cbd6
dondominio: Whitespace fixes
2024-07-27 04:40:34 -04:00
Richard Hansen
e155e1bf2c
dondominio: Delete unnecessary comments
2024-07-27 04:40:34 -04:00
Richard Hansen
d62495c41e
ddns.fm: Improve log messages
2024-07-27 04:40:34 -04:00
Richard Hansen
1195a40c45
freemyip: Check entire result body, not just first line
...
This is simpler, and should be more resilient to bugs.
2024-07-27 04:40:34 -04:00
Richard Hansen
3ece2017e9
freemyip: Skip headers before processing response
...
This isn't strictly necessary but improves readability and
consistency.
2024-07-27 04:40:34 -04:00