From 462a2ae3672ba56d0c506f86cff2a2eb66e154a2 Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Fri, 23 Jan 2015 15:13:56 -0600 Subject: [PATCH] Rename 'redis_server' arg to 'redis' --- plugins/greylisting | 8 ++++---- t/plugin_tests/greylisting | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/greylisting b/plugins/greylisting index 8dcf3f5..20e6a58 100644 --- a/plugins/greylisting +++ b/plugins/greylisting @@ -104,7 +104,7 @@ usable directory from the following list will be used: =back -=head2 redis_server +=head2 redis Location of redis server where the greylisting DB will be stored. @@ -179,7 +179,7 @@ my $VERSION = '0.12'; my $DENYMSG = "This mail is temporarily denied"; my %PERMITTED_ARGS = map { $_ => 1 } qw(per_recipient remote_ip sender - recipient black_timeout white_timeout deny_late db_dir redis_server + recipient black_timeout white_timeout deny_late db_dir redis nfslock p0f reject loglevel geoip upgrade ); $PERMITTED_ARGS{grey_timeout} = 1; # Legacy argument now ignored @@ -233,7 +233,7 @@ sub register_hooks { sub init_db { my ($self) = @_; - return $self->init_redis if $self->{_args}{redis_server}; + return $self->init_redis if $self->{_args}{redis}; return $self->init_dbm; } @@ -253,7 +253,7 @@ sub init_redis { sub parse_redis_server { my ($self) = @_; - my $server = $self->{_args}{redis_server}; + my $server = $self->{_args}{redis}; return $server if $server =~ /:/; return "$server:6379"; } diff --git a/t/plugin_tests/greylisting b/t/plugin_tests/greylisting index b75f01f..7737fd3 100644 --- a/t/plugin_tests/greylisting +++ b/t/plugin_tests/greylisting @@ -285,27 +285,27 @@ sub rc { sub test_init_redis { my ($self) = @_; delete $self->{db}; - $self->{_args}{redis_server} = 'bogusserverasdfqwerty.:6379'; + $self->{_args}{redis} = 'bogusserverasdfqwerty.:6379'; ok( ! $self->init_redis, 'init_redis() fails on bogus server' ); eval { Qpsmtpd::DB::Redis->new }; return if $@; - $self->{_args}{redis_server} = 'localhost'; + $self->{_args}{redis} = 'localhost'; ok( $self->init_redis, 'init_redis() succeeds when redis is up' ); } sub test_init_dbm { my ($self) = @_; delete $self->{db}; - delete $self->{_args}{redis_server}; + delete $self->{_args}{redis}; ok( $self->init_db, 'init_db() works for DBM' ); } sub test_parse_redis_server { my ($self) = @_; - $self->{_args}{redis_server} = 'asdf:1234'; + $self->{_args}{redis} = 'asdf:1234'; is( $self->parse_redis_server, 'asdf:1234', 'parse_redis_server(): leave provided port alone' ); - $self->{_args}{redis_server} = 'qwerty'; + $self->{_args}{redis} = 'qwerty'; is( $self->parse_redis_server, 'qwerty:6379', 'parse_redis_server(): add default port' ); }