-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add --hints option #284
Add --hints option #284
Conversation
This PR fails in CI because it depends on zonemaster/zonemaster-engine#1134 and that one hasn't been merged yet. When I run the test locally against that version of Engine the tests pass just fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works as it should when using a legal file after installing the correct version of Engine too.
When I make the local name.root file break some of the rules, it stops, but the error message is hard to understand because the context is missing. I accept as-is, and it could be improved later.
Examples:
$ zonemaster-cli --show-testcase --level INFO xa --hint /usr/local/etc/zonemaster/named.root--xa
Seconds Level Testcase Message
======= ========= ============== =======
Forbidden directive $TTL
$ zonemaster-cli --show-testcase --level INFO xa --hint /usr/local/etc/zonemaster/named.root--xa
Seconds Level Testcase Message
======= ========= ============== =======
Owner name for NS record must be "."
I made an update to add some context to the error message. I also postponed the printing of column headers until just before we start running the actual test.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine with the updated error messages.
@marc-vanderwal, could you review this too? It is related to zonemaster/zonemaster-engine#1134 that you reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@mattias-p, could you merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found one potential issue (not linked to this PR) during release testing (2022-2). See first snipet below. Test will start without any error, and considers the option to be turned off when set to 0. This is also the case for other options in CLI that take a file (string) as input (e.g., --restore
). Can this be considered intended behavior? If not then an issue should be opened in CLI. I think it has to do with Moose.
$ ls -l
total 4
-rw-r--r-- 1 tgreen tgreen 53 Dec 8 14:26 named.custom-root
$ zonemaster-cli --hints 0 zonemaster.net
Seconds Level Message
======= ========= =======
[...] // NO ERROR
$ zonemaster-cli --restore 0 zonemaster.fr
Seconds Level Message
======= ========= =======
[...] // NO ERROR
If I create file '0' and pass it as hint to CLI:
$ ls -l
total 8
-rw-r--r-- 1 tgreen tgreen 44 Dec 8 14:59 0
-rw-r--r-- 1 tgreen tgreen 53 Dec 8 14:26 named.custom-root
$ cat 0
. IN NS ns.fake.
ns.fake. IN A 192.168.1.1
$ zonemaster-cli --hints 0 zonemaster.fr
Seconds Level Message
======= ========= =======
[ ... ] // NO ERROR
$ zonemaster-cli --hints '0' zonemaster.fr
Seconds Level Message
======= ========= =======
[ ... ] // NO ERROR
Other use cases appear to be handled correctly:
$ cat named.custom-root
. IN NS ns.fake.
ns.fake. IN A 192.168.1.1
$ zonemaster-cli --hints 5 zonemaster.fr
Error loading hints file: read_file '5' - open: No such file or directory at /usr/local/share/perl/5.32.1/Zonemaster/CLI.pm line 496.
$ zonemaster-cli --hints @123! zonemaster.fr
Error loading hints file: read_file '@123!' - open: No such file or directory at /usr/local/share/perl/5.32.1/Zonemaster/CLI.pm line 496.
$ zonemaster-cli --hints -1 zonemaster.fr
Error loading hints file: read_file '-1' - open: No such file or directory at /usr/local/share/perl/5.32.1/Zonemaster/CLI.pm line 496.
$ zonemaster-cli --hints named.custom-root zonemaster.fr
Seconds Level Message
======= ========= =======
[...] // EXPECTED ERROR
$ zonemaster-cli --hints 'named.custom-root' zonemaster.fr
Seconds Level Message
======= ========= =======
[...] // EXPECTED ERROR
$ zonemaster-cli --restore 1 zonemaster.fr
Failed to open restore data file: No such file or directory
I file with name "0" cannot be true in the world of Perl. But file "00" is a true file. |
For now a possible workaround is to use |
Purpose
Allow the user to override the built in root hints.
Context
This change depends on zonemaster/zonemaster-engine#1134.
Changes
A new
--hints=FILENAME
option is added.How to test this PR
--hints named.custom-root
and make sure it works as expected.