diff --git a/manifests/config.pp b/manifests/config.pp index 3fcd135..4047ef2 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -43,15 +43,19 @@ # get the first argument and only use that for creating the file (don't use spaces in filename) $authuserfile = split($real_options['Global']['AuthUserFile'], ' ')[0] - $authuser_require = File[$authuserfile] - if !defined(File[$authuserfile]) { - file { $authuserfile: - source => $proftpd::authuserfile_source, - owner => $proftpd::user, - group => $proftpd::group, - mode => '0600', - before => File[$proftpd::config], + if !$proftpd::manage_ftpasswd_file { + $authuser_require = File[$authuserfile] + if !defined(File[$authuserfile]) { + file { $authuserfile: + source => $proftpd::authuserfile_source, + owner => $proftpd::user, + group => $proftpd::group, + mode => '0600', + before => File[$proftpd::config], + } } + } else { + $authuser_require = false } } else { $authuser_require = false @@ -127,28 +131,22 @@ } concat { $modules_config: + warn => true, owner => $proftpd::config_user, group => $proftpd::config_group, # modules may be required for validate_cmd to succeed before => File[$proftpd::config], notify => Class[proftpd::service], } - - concat::fragment { 'proftp_modules_header': - target => "${proftpd::base_dir}/modules.conf", - content => "# File is managed by Puppet\n", - order => '01', - } } if $proftpd::manage_ftpasswd_file { concat { $proftpd::ftpasswd_file: - mode => $proftpd::config_mode, - owner => $proftpd::user, - group => $proftpd::group, - } - concat::fragment { '01-ftpasswd_file-header': - target => $proftpd::ftpasswd_file, - content => "### Managed by Puppet - Changes will be lost\n", + warn => true, + mode => '0600', + owner => $proftpd::user, + group => $proftpd::group, + before => File[$proftpd::config], + notify => Class[proftpd::service], } } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 55e4f79..4a12b8d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -47,10 +47,6 @@ it { is_expected.to contain_package(expected_packages.first) } it { is_expected.to contain_service(expected_service_name) } it { is_expected.to contain_concat("#{expected_base_dir}/modules.conf") } - it do - is_expected.to contain_concat__fragment('proftp_modules_header') - .with_target("#{expected_base_dir}/modules.conf") - end end context 'with manage_ftpasswd_file set to true' do let(:params) do diff --git a/spec/defines/ftpasswd_user_spec.rb b/spec/defines/ftpasswd_user_spec.rb index 0948cfd..6b15482 100644 --- a/spec/defines/ftpasswd_user_spec.rb +++ b/spec/defines/ftpasswd_user_spec.rb @@ -37,7 +37,6 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_concat(expected_ftpasswd_file) } - it { is_expected.to contain_concat__fragment('01-ftpasswd_file-header') } it do is_expected.to contain_concat__fragment('10-entry-foobar') .with_content(%r{foobar:123456:1001:1001:foobar:/home/foobar:/bin/false}) @@ -57,7 +56,6 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_concat(expected_ftpasswd_file) } - it { is_expected.to contain_concat__fragment('01-ftpasswd_file-header') } it do is_expected.to contain_concat__fragment('10-entry-foobar') .with_content(%r{foobar:123456:1001:1001:Foobar user:/var/www/html:/bin/ksh})