diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-05-26 09:20:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-05-26 09:33:43 +0300 |
commit | f12defd06dfab84dd5a6a1d6f9839d6bb3af2c62 (patch) | |
tree | 7f7b3c3f3a2fe45161e2855c9a9ce73a67dfc612 | |
parent | 585a5a925342c357d46fbad273bfafc03bc33dcd (diff) | |
download | config-haproxy-f12defd06dfab84dd5a6a1d6f9839d6bb3af2c62.tar.gz config-haproxy-f12defd06dfab84dd5a6a1d6f9839d6bb3af2c62.tar.bz2 |
Config::HAProxy version 1.03v1.03
-rw-r--r-- | Changes | 6 | ||||
-rw-r--r-- | lib/Config/HAProxy.pm | 18 | ||||
-rw-r--r-- | t/Test/HAProxy.pm | 1 |
3 files changed, 16 insertions, 9 deletions
@@ -1,8 +1,14 @@ | |||
1 | Revision history for Perl extension Config::HAProxy. | 1 | Revision history for Perl extension Config::HAProxy. |
2 | 2 | ||
3 | 1.03 Sun May 26 09:12:10 2019 | ||
4 | - implement configuration syntax check | ||
5 | |||
6 | 1.02 Mon Jul 16 07:38:31 2018 | ||
7 | - remove the leftover use of autodie | ||
8 | |||
3 | 1.01 Thu Jul 12 09:04:28 2018 | 9 | 1.01 Thu Jul 12 09:04:28 2018 |
4 | - set minimal required Perl version | 10 | - set minimal required Perl version |
5 | - drop dependency on autodie | 11 | - drop dependency on autodie |
6 | 12 | ||
7 | 1.00 Sun Jul 8 19:57:57 2018 | 13 | 1.00 Sun Jul 8 19:57:57 2018 |
8 | - original revision | 14 | - original revision |
diff --git a/lib/Config/HAProxy.pm b/lib/Config/HAProxy.pm index ff4fa8a..794a80f 100644 --- a/lib/Config/HAProxy.pm +++ b/lib/Config/HAProxy.pm | |||
@@ -13,13 +13,13 @@ use File::Basename; | |||
13 | use File::Temp qw(tempfile); | 13 | use File::Temp qw(tempfile); |
14 | use File::stat; | 14 | use File::stat; |
15 | use File::Spec; | 15 | use File::Spec; |
16 | use IPC::Cmd; | 16 | use IPC::Cmd; |
17 | use Carp; | 17 | use Carp; |
18 | 18 | ||
19 | our $VERSION = '1.01'; | 19 | our $VERSION = '1.03'; |
20 | 20 | ||
21 | my %sections = ( | 21 | my %sections = ( |
22 | global => 1, | 22 | global => 1, |
23 | defaults => 1, | 23 | defaults => 1, |
24 | frontend => 1, | 24 | frontend => 1, |
25 | backend => 1, | 25 | backend => 1, |
@@ -426,36 +426,38 @@ Returns the top of the tree. | |||
426 | Returns the last node in the tree. | 426 | Returns the last node in the tree. |
427 | 427 | ||
428 | =head1 SAVING | 428 | =head1 SAVING |
429 | 429 | ||
430 | =head2 lint | 430 | =head2 lint |
431 | 431 | ||
432 | $cfg->lint(%ARGS); | 432 | $cfg->lint(%hash); |
433 | 433 | ||
434 | Configures syntax checking program to be run before saving. Takes a | 434 | Configures configuration syntax check. The check will be run by the B<save> |
435 | hash as argument. Allowed keys are: | 435 | method prior to writing to the configuration file. Takes a hash as argument. |
436 | Allowed keys are: | ||
436 | 437 | ||
437 | =over 4 | 438 | =over 4 |
438 | 439 | ||
439 | =item B<enable =E<gt> I<BOOL>> | 440 | =item B<enable =E<gt> I<BOOL>> |
440 | 441 | ||
441 | If I<BOOL> is 0, disables syntax check. Default is 1. | 442 | If I<BOOL> is 0, disables syntax check. Default is 1. |
442 | 443 | ||
443 | =item B<command =E<gt> I<CMD>> | 444 | =item B<command =E<gt> I<CMD>> |
444 | 445 | ||
445 | Configures the command to use for syntax check. The command will be run as | 446 | Defines the shell command to use for syntax check. The command will be run |
447 | as | ||
446 | 448 | ||
447 | CMD FILE | 449 | CMD FILE |
448 | 450 | ||
449 | where I<FILE> is the name of the HAProxy configuration file to check. | 451 | where I<FILE> is the name of the HAProxy configuration file to check. |
450 | 452 | ||
451 | Default command is B<haproxy -c -f>. | 453 | Default command is B<haproxy -c -f>. |
452 | 454 | ||
453 | =item B<path =E<gt> I<PATH>> | 455 | =item B<path =E<gt> I<PATH>> |
454 | 456 | ||
455 | Sets the search path for the check program. I<PATH> is a colon-delimited | 457 | Sets the search path for the syntax checker. I<PATH> is a colon-delimited |
456 | list of directories. Unless the first word of B<command> is an absolute | 458 | list of directories. Unless the first word of B<command> is an absolute |
457 | file name, it will be looked for in these directories. The first match | 459 | file name, it will be looked for in these directories. The first match |
458 | will be used. Default is system B<$PATH>. | 460 | will be used. Default is system B<$PATH>. |
459 | 461 | ||
460 | =back | 462 | =back |
461 | 463 | ||
@@ -464,14 +466,14 @@ Returns the command name. | |||
464 | =head2 save | 466 | =head2 save |
465 | 467 | ||
466 | $cfg->save(%hash); | 468 | $cfg->save(%hash); |
467 | 469 | ||
468 | Saves the parse tree in the configuration file. Syntax check will be run | 470 | Saves the parse tree in the configuration file. Syntax check will be run |
469 | prior to saving (unless previously disabled). If syntax errors are discovered, | 471 | prior to saving (unless previously disabled). If syntax errors are discovered, |
470 | the method will B<croak> with the appropriate diagnostics, beginning with | 472 | the method will B<croak> with a diagnostic message starting with words |
471 | words C<Syntax check failed:>. | 473 | C<Syntax check failed:>. |
472 | 474 | ||
473 | If I<%hash> contains a non-zero B<dry_run> value, B<save> will only run syntax | 475 | If I<%hash> contains a non-zero B<dry_run> value, B<save> will only run syntax |
474 | check, without actually saving the file. If B<$cfg-E<gt>lint(enable =E<gt> 0)> | 476 | check, without actually saving the file. If B<$cfg-E<gt>lint(enable =E<gt> 0)> |
475 | was called previously, this is a no-op. | 477 | was called previously, this is a no-op. |
476 | 478 | ||
477 | Other keys in I<%hash> are the same as in B<write>, described below. | 479 | Other keys in I<%hash> are the same as in B<write>, described below. |
diff --git a/t/Test/HAProxy.pm b/t/Test/HAProxy.pm index b5b8a19..ca7d8ce 100644 --- a/t/Test/HAProxy.pm +++ b/t/Test/HAProxy.pm | |||
@@ -1,13 +1,12 @@ | |||
1 | package Test::HAProxy; | 1 | package Test::HAProxy; |
2 | use strict; | 2 | use strict; |
3 | use warnings; | 3 | use warnings; |
4 | use parent 'Config::HAProxy'; | 4 | use parent 'Config::HAProxy'; |
5 | use File::Basename; | 5 | use File::Basename; |
6 | use File::Temp; | 6 | use File::Temp; |
7 | use autodie; | ||
8 | 7 | ||
9 | sub new { | 8 | sub new { |
10 | my $class = shift; | 9 | my $class = shift; |
11 | 10 | ||
12 | my $file = new File::Temp; | 11 | my $file = new File::Temp; |
13 | while (<main::DATA>) { | 12 | while (<main::DATA>) { |