Commit ab4cfb9 Joshua Hoblitt
committed
1 parent f50f4db commit ab4cfb9 Copy full SHA for ab4cfb9
File tree 4 files changed +105
-100
lines changed
4 files changed +105
-100
lines changed Original file line number Diff line number Diff line change 12
12
#
13
13
# - implement template and variables for the pgsql config file
14
14
#
15
+ class pureftpd::config::pgsql (
16
+ $pgsqlserver = undef ,
17
+ $pgsqlport = undef ,
18
+ $pgsqluser = undef ,
19
+ $pgsqlpassword = undef ,
20
+ $pgsqldatabase = undef ,
21
+ $pgsqlcrypt = undef ,
22
+ $pgsqlgetpw = undef ,
23
+ $pgsqlgetuid = undef ,
24
+ $pgsqldefaultuid = undef ,
25
+ $pgsqlgetgid = undef ,
26
+ $pgsqldefaultgid = undef ,
27
+ $pgsqlgetdir = undef ,
28
+ $pgsqlgetqtafs = undef ,
29
+ $pgsqlgetqtasz = undef ,
30
+ $pgsqlgetratioul = undef ,
31
+ $pgsqlgetratiodl = undef ,
32
+ $pgsqlgetbandwidthul = undef ,
33
+ $pgsqlgetbandwidthdl = undef ,
34
+ ) inherits pureftpd::params {
15
35
16
- class pureftpd::config::pgsql inherits pureftpd::params {
36
+ # pure-ftpd-1.0.30/src/log_pgsql_p.h
37
+ $conf_options = [
38
+ ' PGSQLServer' ,
39
+ ' PGSQLPort' ,
40
+ ' PGSQLUser' ,
41
+ ' PGSQLPassword' ,
42
+ ' PGSQLDatabase' ,
43
+ ' PGSQLCrypt' ,
44
+ ' PGSQLGetPW' ,
45
+ ' PGSQLGetUID' ,
46
+ ' PGSQLDefaultUID' ,
47
+ ' PGSQLGetGID' ,
48
+ ' PGSQLDefaultGID' ,
49
+ ' PGSQLGetDir' ,
50
+ ' PGSQLGetQTAFS' ,
51
+ ' PGSQLGetQTASZ' ,
52
+ ' PGSQLGetRatioUL' ,
53
+ ' PGSQLGetRatioDL' ,
54
+ ' PGSQLGetBandwidthUL' ,
55
+ ' PGSQLGetBandwidthDL' ,
56
+ ]
17
57
18
58
file { $pureftpd::params::pgsql_conf_path :
19
59
ensure => file ,
Original file line number Diff line number Diff line change 26
26
$mysql_conf_erb = ' redhat/pureftpd-mysql.conf.erb'
27
27
$mysql_conf_path = " ${config_dir} /pureftpd-mysql.conf"
28
28
29
- $pgsql_conf_erb = ' redhat/pureftpd-pgsql .conf.erb'
29
+ $pgsql_conf_erb = ' redhat/pure-ftpd .conf.erb'
30
30
$pgsql_conf_path = " ${config_dir} /pureftpd-pgsql.conf"
31
31
}
32
32
default:{
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ test_options = [
4
+ 'PGSQLServer' ,
5
+ 'PGSQLPort' ,
6
+ 'PGSQLUser' ,
7
+ 'PGSQLPassword' ,
8
+ 'PGSQLDatabase' ,
9
+ 'PGSQLCrypt' ,
10
+ 'PGSQLGetPW' ,
11
+ 'PGSQLGetUID' ,
12
+ 'PGSQLDefaultUID' ,
13
+ 'PGSQLGetGID' ,
14
+ 'PGSQLDefaultGID' ,
15
+ 'PGSQLGetDir' ,
16
+ 'PGSQLGetQTAFS' ,
17
+ 'PGSQLGetQTASZ' ,
18
+ 'PGSQLGetRatioUL' ,
19
+ 'PGSQLGetRatioDL' ,
20
+ 'PGSQLGetBandwidthUL' ,
21
+ 'PGSQLGetBandwidthDL' ,
22
+ ]
23
+
24
+ describe 'pureftpd::config::pgsql' do
25
+
26
+ shared_examples 'config' do |params , content |
27
+ let ( :facts ) { { :osfamily => 'RedHat' } }
28
+ let ( :params ) { params }
29
+
30
+ it do
31
+ should include_class ( 'pureftpd::config::pgsql' )
32
+ should contain_file ( '/etc/pure-ftpd/pureftpd-pgsql.conf' ) \
33
+ . with_ensure ( 'file' ) \
34
+ . with_content ( content )
35
+ end
36
+ end
37
+
38
+ all_params = { }
39
+ all_content = ''
40
+ value = 'xxx'
41
+
42
+ # accumutate all of the params and content strings as we test each individual
43
+ # option so we can use them for the next test
44
+ context 'one option at a time' do
45
+ test_options . each do |option |
46
+ params = { }
47
+ params [ option . downcase . to_sym ] = value
48
+ content = sprintf ( "%-19s %s\n " , option , value )
49
+
50
+ all_params . merge! ( params )
51
+ all_content += content
52
+
53
+ it_behaves_like 'config' , params , content
54
+ end
55
+ end
56
+
57
+ # test all of the known options at once this works because the ordering of
58
+ # options values in the output file is fixed
59
+ context 'all options' do
60
+ it_behaves_like 'config' , all_params , all_content
61
+ end
62
+
63
+ end
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments