From da90b094e7973bc4b7dedcd5cad086dc1d7a8fee Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Wed, 11 Sep 2019 14:37:23 +0300 Subject: Bugfixes. * Changes: Update * Makefile.PL: Require Config::Parser. * lib/App/Acmeman.pm: Implement the --version option. * lib/App/Acmeman/Source/Apache.pm (scan): Set core.postrenew from layout, if it is not set explicitly. * lib/App/Acmeman/Source/File.pm (scan): Fix inverted logic (load returns false on error. --- Changes | 4 ++++ Makefile.PL | 3 ++- lib/App/Acmeman.pm | 44 ++++++++++++++++++++++------------------ lib/App/Acmeman/Source/Apache.pm | 3 ++- lib/App/Acmeman/Source/File.pm | 4 +++- 5 files changed, 35 insertions(+), 23 deletions(-) diff --git a/Changes b/Changes index 1c25821..dcf480c 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +2.01 2019-09-11 + - Fix the "file" source (inverted logic was assumed) + - Implement the --version option. + 2.00 2019-08-26 - Released on CPAN diff --git a/Makefile.PL b/Makefile.PL index 0d093a8..f7195d4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -33,7 +33,8 @@ my %makefile_args = ( 'Socket' => 0, 'Sys::Hostname' => 1.16, 'Apache::Defaults' => 1.02, - 'Apache::Config::Preproc' => 1.03 + 'Apache::Config::Preproc' => 1.03, + 'Config::Parser' => 1.03 }, MIN_PERL_VERSION => 5.016001, META_MERGE => { diff --git a/lib/App/Acmeman.pm b/lib/App/Acmeman.pm index 8f253b2..99d018a 100644 --- a/lib/App/Acmeman.pm +++ b/lib/App/Acmeman.pm @@ -16,7 +16,7 @@ use Socket qw(inet_ntoa); use Sys::Hostname; use Pod::Usage; use Pod::Man; -use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_version); +use Getopt::Long qw(:config gnu_getopt no_ignore_case); use POSIX qw(strftime time floor); use App::Acmeman::Config; use App::Acmeman::Domain qw(:files); @@ -25,7 +25,7 @@ use Text::ParseWords; use App::Acmeman::Log qw(:all :sysexits); use feature 'state'; -our $VERSION = '2.00'; +our $VERSION = '2.01'; my $progdescr = "manages ACME certificates"; @@ -46,24 +46,28 @@ sub new { _domains => [] }, $class; GetOptions( - "h" => sub { - pod2usage(-message => "$self->{_progname}: $progdescr", - -exitstatus => EX_OK); - }, - "help" => sub { - pod2usage(-exitstatus => EX_OK, -verbose => 2); - }, - "usage" => sub { - pod2usage(-exitstatus => EX_OK, -verbose => 0); - }, - "debug|d+" => \$self->{_option}{debug}, - "dry-run|n" => \$self->{_option}{dry_run}, - "stage|s" => sub { $self->{_acme_host} = 'staging' }, - "force|F" => \$self->{_option}{force}, - "time-delta|D=n" => \$self->{_option}{time_delta}, - "setup|S" => sub { $self->{_command} = 'setup' }, - "alt-names|a" => \$self->{_option}{check_alt_names}, - "config-file|f=s" => \$self->{_option}{config_file}, + 'h' => sub { + pod2usage(-message => "$self->{_progname}: $progdescr", + -exitstatus => EX_OK); + }, + 'help' => sub { + pod2usage(-exitstatus => EX_OK, -verbose => 2); + }, + 'usage' => sub { + pod2usage(-exitstatus => EX_OK, -verbose => 0); + }, + 'debug|d+' => \$self->{_option}{debug}, + 'dry-run|n' => \$self->{_option}{dry_run}, + 'stage|s' => sub { $self->{_acme_host} = 'staging' }, + 'force|F' => \$self->{_option}{force}, + 'time-delta|D=n' => \$self->{_option}{time_delta}, + 'setup|S' => sub { $self->{_command} = 'setup' }, + 'alt-names|a' => \$self->{_option}{check_alt_names}, + 'config-file|f=s' => \$self->{_option}{config_file}, + 'version' => sub { + print "$0 version $VERSION\n"; + exit(EX_OK) + } ) or exit(EX_USAGE); ++$self->{_option}{debug} if $self->dry_run_option; debug_level($self->{_option}{debug}); diff --git a/lib/App/Acmeman/Source/Apache.pm b/lib/App/Acmeman/Source/Apache.pm index 042956a..ae9c342 100644 --- a/lib/App/Acmeman/Source/Apache.pm +++ b/lib/App/Acmeman/Source/Apache.pm @@ -31,7 +31,8 @@ sub layout { shift->{_layout} } sub scan { my ($self) = @_; debug(2, 'assuming Apache layout "'.$self->layout->name.'"'); - $self->set(qw(core postrenew), $self->layout->restart_command); + $self->set(qw(core postrenew), $self->layout->restart_command) + unless $self->cfg->is_set(qw(core postrenew)); return $self->examine_http_config($self->layout->config_file); } diff --git a/lib/App/Acmeman/Source/File.pm b/lib/App/Acmeman/Source/File.pm index c622d51..aa678fd 100644 --- a/lib/App/Acmeman/Source/File.pm +++ b/lib/App/Acmeman/Source/File.pm @@ -36,7 +36,9 @@ sub scan { } foreach my $file (glob $self->{pattern}) { next if $file =~ m{$self->{ignore}}; - $err |= $self->load($file); + unless ($self->load($file)) { + ++$err; + } } return $err == 0; } -- cgit v1.2.1