Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't use file resource, when concat is in use #49

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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],
}
}
}
4 changes: 0 additions & 4 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions spec/defines/ftpasswd_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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})
Expand Down