Skip to content

Commit

Permalink
Merge pull request #379 from zonemaster/develop
Browse files Browse the repository at this point in the history
Merge develop into master (CLI)
  • Loading branch information
matsduf authored Jul 1, 2024
2 parents e7dde95 + ff33199 commit 18dcbba
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 59 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ dist: jammy
language: perl

perl:
- "5.36"
- "5.30"
- "5.38"
- "5.34"
- "5.26"

addons:
apt:
packages:
# From Zonemaster Engine installation instruction
# From Zonemaster Engine installation instruction for Ubuntu
- autoconf
- automake
- build-essential
Expand Down Expand Up @@ -38,8 +38,10 @@ addons:
- libtext-csv-perl
- libtool
- m4
# From Zonemaster CLI installation instruction
- libtext-reflow-perl
# From Zonemaster CLI installation instruction for Ubuntu
# libmoosex-getopt-perl, see cpan-install below
# libmodule-install-perl, see cpan-install below
- libtry-tiny-perl

before_install:
# Help Perl find modules installed from OS packages
Expand Down
16 changes: 16 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Release history for Zonemaster component Zonemaster-CLI


v7.0.0 2024-07-01 (part of Zonemaster v2024.1 release)

[Release information]
- Translations have not been fully updated in this release. They will
be updated in an upcoming release.

[Breaking change]
- Removes deprecated '--sourceaddr' option. Breaks custom 'cli.args'
using this option. Use '--sourceaddr4' and '--sourceaddr6'
instead. (#370)

[Fixes]
- Fixes command line argument handling of domain names (#365)
- Speeds up Docker build (#374)


v6.1.0 2024-03-18 (public release version)

[Features]
Expand Down
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
FROM zonemaster/engine:local as build

RUN apk add --no-cache \
# Only needed for Net::Interface
build-base \
make \
perl-app-cpanminus \
perl-cpan-meta-check \
perl-data-dump \
perl-dev \
perl-doc \
perl-json-xs \
perl-lwp-protocol-https \
make \
# Compile-time dependencies
perl-app-cpanminus \
perl-module-build \
perl-module-build-tiny \
perl-module-install \
perl-moose \
perl-namespace-autoclean \
perl-params-validate \
perl-path-tiny \
perl-test-deep \
perl-test-needs \
&& cpanm --no-wget --from https://cpan.metacpan.org/ \
MooseX::Getopt \
Text::Reflow
MooseX::Getopt

ARG version

Expand All @@ -23,6 +31,12 @@ RUN cpanm --no-wget \

FROM zonemaster/engine:local

RUN apk add --no-cache \
perl-namespace-autoclean \
perl-params-validate \
perl-json-xs \
perl-moose

COPY --from=build /usr/local/bin/zonemaster-cli /usr/local/bin/zonemaster-cli
# Include all the Perl modules we built
COPY --from=build /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/site_perl
Expand Down
5 changes: 2 additions & 3 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ requires(
'JSON::XS' => 0,
'Locale::TextDomain' => 1.23,
'MooseX::Getopt' => 0,
'Text::Reflow' => 0,
'Try::Tiny' => 0,
'Zonemaster::LDNS' => 4.000000, # v4.0.0
'Zonemaster::Engine' => 5.000000, # v5.0.0
'Zonemaster::LDNS' => 4.000002, # v4.0.2
'Zonemaster::Engine' => 6.000000, # v6.0.0
);

# Make all platforms include inc/Module/Install/External.pm
Expand Down
43 changes: 9 additions & 34 deletions lib/Zonemaster/CLI.pm
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use 5.014002;
use strict;
use warnings;

use version; our $VERSION = version->declare( "v6.1.0" );
use version; our $VERSION = version->declare( "v7.0.0" );

use Locale::TextDomain 'Zonemaster-CLI';
use Moose;
Expand All @@ -24,8 +24,6 @@ use JSON::XS;
use List::Util qw[max uniq];
use POSIX qw[setlocale LC_MESSAGES LC_CTYPE];
use Scalar::Util qw[blessed];
use Socket qw[AF_INET AF_INET6];
use Text::Reflow qw[reflow_string];
use Try::Tiny;
use Net::IP::XS;

Expand All @@ -36,7 +34,6 @@ use Zonemaster::Engine::Normalization qw[normalize_name];
use Zonemaster::Engine::Logger::Entry;
use Zonemaster::Engine::Translator;
use Zonemaster::Engine::Util qw[parse_hints];
use Zonemaster::Engine::Zone;

our %numeric = Zonemaster::Engine::Logger::Entry->levels;
our $JSON = JSON::XS->new->allow_blessed->convert_blessed->canonical;
Expand Down Expand Up @@ -278,26 +275,13 @@ has 'dump_profile' => (
documentation => __( 'Print the effective profile used in JSON format, then exit.' ),
);

has 'sourceaddr' => (
is => 'ro',
isa => 'Str',
required => 0,
documentation => __(
'Deprecated (planned removal: v2024.1). '
. 'Use --sourceaddr4 and/or --sourceaddr6. '
. 'Source IP address used to send queries. '
. 'Setting an IP address not correctly configured on a local network interface causes cryptic error messages.'
),
);

has 'sourceaddr4' => (
is => 'ro',
isa => 'Str',
required => 0,
documentation => __(
'Source IPv4 address used to send queries. '
. 'Setting an IPv4 address not correctly configured on a local network interface fails silently. '
. 'Can not be combined with --sourceaddr.'
. 'Setting an IPv4 address not correctly configured on a local network interface fails silently.'
),
);

Expand All @@ -307,8 +291,7 @@ has 'sourceaddr6' => (
required => 0,
documentation => __(
'Source IPv6 address used to send queries. '
. 'Setting an IPv6 address not correctly configured on a local network interface fails silently. '
. 'Can not be combined with --sourceaddr.'
. 'Setting an IPv6 address not correctly configured on a local network interface fails silently.'
),
);

Expand Down Expand Up @@ -356,14 +339,6 @@ sub run {
print_test_list();
}

if ( $self->sourceaddr ) {
if ( $self->sourceaddr4 or $self->sourceaddr6 ) {
die __( "Error: --sourceaddr can't be combined with --sourceaddr4 or --sourceaddr6." ) . "\n";
}
printf STDERR "%s\n\n", __( "Warning: --sourceaddr is deprecated (planned removal: v2024.1). Use --sourceaddr4 and/or --sourceaddr6 instead." );
Zonemaster::Engine::Profile->effective->set( q{resolver.source}, $self->sourceaddr );
}

if ( $self->sourceaddr4 ) {
Zonemaster::Engine::Profile->effective->set( q{resolver.source4}, $self->sourceaddr4 );
}
Expand Down Expand Up @@ -631,18 +606,13 @@ sub run {
}
);

if ( $self->profile or $self->test ) {
# Separate initialization from main output in human readable output mode
print "\n" if $fh_diag eq *STDOUT;
}

if ( scalar @{ $self->extra_argv } > 1 ) {
die __( "Only one domain can be given for testing. Did you forget to prepend an option with '--<OPTION>'?\n" );
}

my ( $domain ) = @{ $self->extra_argv };

if ( not $domain ) {
if ( !defined $domain ) {
die __( "Must give the name of a domain to test.\n" );
}

Expand Down Expand Up @@ -677,6 +647,11 @@ sub run {
$self->add_fake_ds( $domain );
}

if ( $self->profile or $self->test ) {
# Separate initialization from main output in human readable output mode
print "\n" if $fh_diag eq *STDOUT;
}

if ( not $self->raw and not $self->json ) {
my $header = q{};

Expand Down
13 changes: 2 additions & 11 deletions script/zonemaster-cli
Original file line number Diff line number Diff line change
Expand Up @@ -256,26 +256,17 @@ name servers took to answer.

Print the effective profile used in JSON format, then exit.

=item --sourceaddr=IPADDR

Deprecated since v2023.1 (planned removal: v2024.1), use --sourceaddr4
and/or --sourceaddr6 instead.

Specify the source IP address used to send queries.
Setting an IP address not correctly configured on a local network interface
causes cryptic error messages.

=item --sourceaddr4=IPADDR

Specify the source IPv4 address used to send queries.
Setting an IPv4 address not correctly configured on a local network interface
fails silently. Can not be combined with --sourceaddr.
fails silently.

=item --sourceaddr6=IPADDR

Specify the source IPv6 address used to send queries.
Setting an IPv6 address not correctly configured on a local network interface
fails silently. Can not be combined with --sourceaddr.
fails silently.

=item --[no-]elapsed

Expand Down

0 comments on commit 18dcbba

Please sign in to comment.