Richard Hansen
a21e215ada
Reduce unnecessary values in %config
and %recap
...
* Delete values from `$config{$h}` and `$recap{$h}` when resetting
values (as opposed to setting a falsy value).
* Delete values from `$config{$h}` and `$recap{$h}` when they are no
longer needed.
This is mostly done to improve the tests in `t/update_nics.pl`.
2024-08-22 02:08:39 -04:00
Richard Hansen
f024bcce34
Dynamically compute default for use
based on usev4
, usev6
...
This is mostly to simplify tests, but it also improves readability.
The infrastructure changes in this commit also make it possible to
introduce a new `url` variable that defaults to `opt('server', $h)`
concatenated with `opt('script', $h)` so that we can start migrating
away from those user-unfriendly variables.
2024-08-22 02:08:39 -04:00
Richard Hansen
46bd2f1771
tests: Also test default()
return value
2024-08-22 02:08:39 -04:00
Richard Hansen
555359dc98
tests: Add unit tests for legacy protocol handling in nic_updateable
2024-08-22 02:08:39 -04:00
Richard Hansen
912bc6291a
group_hosts_by: Treat undef
as unset for consistency with opt
...
The `opt` function falls back to global/default if the value is
undefined, even if it is explicitly set to `undef`. `group_hosts_by`
should behave the same.
2024-08-18 01:21:40 -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
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
0c094f6ee8
tests: Fix verbose
option for dnsexit2
protocol tests
...
The `verbose` option is a global option, not a per-host option.
2024-08-18 00:35:44 -04:00
Richard Hansen
a136ba4cdc
tests: Fix ssl
option for dnsexit2
protocol tests
...
The `ssl` option is a global option, not a per-host option. This
commit could instead do:
local $ddclient::globals{ssl} = 0;
but it's more straightforward to include `http://` in the `server`
option, and it tests that `server` supports the inclusion of the
scheme.
2024-08-18 00:35:44 -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
Richard Hansen
2330543cc8
dyndns2: Add comment explaining why keys are listed in test
2024-08-05 19:57:18 -04:00
Richard Hansen
eb281ea47b
dnsexit2: Rename test file for consistency
2024-08-03 03:32:35 -04:00
Richard Hansen
3d345ff08b
dyndns2: Add tests
2024-08-03 03:32:35 -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
439b0fd0e1
Logger: Minimize STDERR override in tests
2024-08-02 17:00:00 -04:00
Richard Hansen
dff4cd4854
Logger: Localize override in test
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
e272caa385
use=web, use=<fw>: Strip HTTP headers before searching for IP
2024-07-27 04:40:34 -04:00
Richard Hansen
b563e9c2fd
use=web: Add tests
2024-07-27 04:40:34 -04:00
Richard Hansen
b1752c2622
logging: Delete unused msg
function
2024-07-27 03:59:29 -04:00
Richard Hansen
6aa68f72a7
logging: Change multi-line log message designation style
...
Before, the first line of a multi-line log message was prefixed with a
space while all subsequent messages were prefixed with `|`. Now the
first line is prefixed with `>` and all subsequent lines with a space.
This makes it easier to quickly discern message boundaries.
2024-07-27 03:47:47 -04:00
Richard Hansen
0ea2f06513
get_ip: Don't mutate $arg
...
This makes log messages easier to understand.
2024-07-26 19:05:47 -04:00
Richard Hansen
8a65264841
group_hosts_by: Return the common group configuration
...
This should make it easier to detect missing attribute names passed to
`group_hosts_by`.
2024-07-13 04:09:24 -04:00
Richard Hansen
b8df93febe
group_hosts_by: Return a list, not a hashref
...
The hash key value is an implementation detail that should not be
leaked to the caller.
2024-07-13 04:08:35 -04:00
Richard Hansen
08ccc41650
group_hosts_by: Use arg list instead of arrayref
...
This is more idiomatic.
2024-07-13 04:08:35 -04:00
Richard Hansen
fa0bfde3cb
Don't assume the default interface has a globally routable IP
2024-07-11 00:18:27 -04:00
Richard Hansen
6af76afde9
Use skip_all
if test precondition is not met
...
Subtests can't have zero checks.
2024-07-11 00:18:27 -04:00
Richard Hansen
01d2db06c1
Invert conditions for readability
2024-07-11 00:18:27 -04:00
Richard Hansen
6e7a4fb460
Split subtest into two subtests
...
This makes it easier to debug failures.
2024-07-11 00:18:27 -04:00
Richard Hansen
49f5551764
Add variable default value tests
2024-06-28 15:53:40 -04:00
Richard Hansen
b426b370fd
Rename %cache
to %recap
for readability
2024-06-22 02:48:03 -04:00
Richard Hansen
211d59fccc
header_ok: Log all non-2xx HTTP status codes
2024-06-06 19:34:06 -04:00
Richard Hansen
adbac91be7
header_ok: Only keep first line of argument
...
This allows callers to pass the entire response without generating
overly long error messages.
2024-06-06 19:34:06 -04:00
Richard Hansen
b58a10b3e3
header_ok: Add unit tests
2024-06-06 19:34:06 -04:00
Richard Hansen
31dbd8e4ed
geturl: Set raw (binary) mode when reading from curl
2024-06-03 03:13:05 -04:00
jortkoopmans
216741c9ce
dnsexit2: Fix when provided with a zone and a non-identical hostname
...
Trim the zone from the hostname in the request to fix issue.
2024-06-02 16:58:00 -04:00
jortkoopmans
ec2d5f7f69
dnsexit2: Add tests
...
Needs LWP::UserAgent.
2024-06-02 16:58:00 -04:00
Richard Hansen
e60e6e804b
group_hosts_by: Use Data::Dumper
to make the group signature
...
This is a bit more robust than manually making the group signature
because it gracefully handles corner cases such as `undef`.
2024-06-01 03:06:06 -04:00
Richard Hansen
ce0a362fd0
group_hosts_by: Add tests
2024-06-01 03:05:26 -04:00
Richard Hansen
d8a9d9d089
Add support for infinite duration
2024-05-25 00:38:10 -04:00
Richard Hansen
9c6e5fdda4
Output a |
character in log message continuation lines
...
This makes it easier to tell where multi-line log messages begin and
end.
2024-05-23 02:04:29 -04:00
Richard Hansen
ff39ce3874
Don't use sprintf
if there is only one argument
...
This avoids problems when logging a string that might have
metacharacters.
2024-05-23 02:04:19 -04:00
Richard Hansen
065b227711
logmsg: New low-level logging interface
2024-05-23 01:57:12 -04:00
Richard Hansen
d02a9cf6db
Add infrastructure for custom logic in a %builtinfw
entry
2024-05-14 22:18:59 -04:00