Skip to content

Commit d50e2af

Browse files
author
Joshua Hoblitt
committed
add missing configuration options/params to pureftpd::config + rspec
1 parent d7ebceb commit d50e2af

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

manifests/config.pp

+7
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@
6262
$anonymousratio = undef,
6363
$userratio = undef,
6464
$umask = undef,
65+
$quota = undef,
66+
$peruserlimits = undef,
67+
$ldapconfigfile = undef,
68+
$mysqlconfigfile = undef,
69+
$pgsqlconfigfile = undef,
70+
$puredb = undef,
71+
$extauth = undef,
6572
) inherits pureftpd::params {
6673

6774
$conf_options = [

spec/classes/config_spec.rb

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
require 'spec_helper'
2+
3+
config_options = [
4+
'IPV4Only',
5+
'IPV6Only',
6+
'ChrootEveryone',
7+
'BrokenClientsCompatibility',
8+
'Daemonize',
9+
'VerboseLog',
10+
'DisplayDotFiles',
11+
'AnonymousOnly',
12+
'NoAnonymous',
13+
'DontResolve',
14+
'AnonymousCanCreateDirs',
15+
'NATmode',
16+
'CallUploadScript',
17+
'AntiWarez',
18+
'AllowUserFXP',
19+
'AllowAnonymousFXP',
20+
'ProhibitDotFilesWrite',
21+
'ProhibitDotFilesRead',
22+
'AllowDotFiles',
23+
'AutoRename',
24+
'AnonymousCantUpload',
25+
'LogPID',
26+
'NoChmod',
27+
'KeepAllFiles',
28+
'CreateHomeDir',
29+
'NoRename',
30+
'CustomerProof',
31+
'NoTruncate',
32+
'FileSystemCharset',
33+
'ClientCharset',
34+
'SyslogFacility',
35+
'FortunesFile',
36+
'ForcePassiveIP',
37+
'Bind',
38+
'AnonymousBandwidth',
39+
'UserBandwidth',
40+
'TrustedIP',
41+
'AltLog',
42+
'PIDFile',
43+
'MaxIdleTime',
44+
'MaxDiskUsage',
45+
'TrustedGID',
46+
'MaxClientsNumber',
47+
'MaxClientsPerIP',
48+
'MaxLoad',
49+
'MinUID',
50+
'TLS',
51+
'LimitRecursion',
52+
'PassivePortRange',
53+
'AnonymousRatio',
54+
'UserRatio',
55+
'Umask',
56+
'Quota',
57+
'PerUserLimits',
58+
'LDAPConfigFile',
59+
'MySQLConfigFile',
60+
'PGSQLConfigFile',
61+
'PureDB',
62+
'ExtAuth',
63+
]
64+
65+
describe 'pureftpd::config' do
66+
67+
shared_examples 'config' do |params, content|
68+
let(:facts) {{ :osfamily=> 'RedHat' }}
69+
let(:params) { params }
70+
71+
it do
72+
should include_class('pureftpd::config')
73+
should contain_file('/etc/pure-ftpd/pure-ftpd.conf') \
74+
.with_ensure('file') \
75+
.with_content(content)
76+
end
77+
end
78+
79+
all_params = {}
80+
all_content = ''
81+
value = 'xxx'
82+
83+
# accumutate all of the params and content strings as we test each individual
84+
# option so we can use them for the next test
85+
config_options.each do |option|
86+
params = {}
87+
params[option.downcase.to_sym] = value
88+
content = sprintf("%-19s %s\n", option, value)
89+
90+
all_params.merge!(params)
91+
all_content += content
92+
93+
it_behaves_like 'config', params, content
94+
end
95+
96+
# test all of the known options at once this works because the ordering of
97+
# options values in the output file is fixed
98+
context 'all parameters' do
99+
it_behaves_like 'config', all_params, all_content
100+
end
101+
102+
end

0 commit comments

Comments
 (0)