Skip to content

Remove deprecated parameters from mod::userdir #2465

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

Merged
merged 3 commits into from
Sep 22, 2023
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
30 changes: 2 additions & 28 deletions manifests/mod/userdir.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# @summary
# Installs and configures `mod_userdir`.
#
# @param home
# *Deprecated* Path to system home directory.
#
# @param dir
# *Deprecated* Path from user's home directory to public directory.
#
# @param userdir
# Path or directory name to be used as the UserDir.
Expand All @@ -31,8 +25,6 @@
# @see https://httpd.apache.org/docs/current/mod/mod_userdir.html for additional documentation.
#
class apache::mod::userdir (
Optional[String] $home = undef,
Optional[String] $dir = undef,
Optional[String[1]] $userdir = undef,
Boolean $disable_root = true,
String $path = '/home/*/public_html',
Expand All @@ -43,36 +35,18 @@
) {
include apache

if $home or $dir {
$_home = $home ? {
undef => '/home',
default => $home,
}
$_dir = $dir ? {
undef => 'public_html',
default => $dir,
}
warning('home and dir are deprecated; use path instead')
$_path = "${_home}/*/${_dir}"
} else {
$_path = $path
}

$_userdir = pick($userdir, $_path)

::apache::mod { 'userdir': }

$parameters = {
'disable_root' => $disable_root,
'_userdir' => $_userdir,
'userdir' => pick($userdir, $path),
'unmanaged_path' => $unmanaged_path,
'_path' => $_path,
'path' => $path,
'overrides' => $overrides,
'options' => $options,
'custom_fragment' => $custom_fragment,
}

# Template uses $home, $dir, $disable_root
file { 'userdir.conf':
ensure => file,
path => "${apache::mod_dir}/userdir.conf",
Expand Down
22 changes: 0 additions & 22 deletions spec/classes/mod/userdir_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,6 @@
it { is_expected.to compile }
end

context 'with dir set to something' do
let :params do
{
dir: 'hi'
}
end

it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/hi$}) }
it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*<Directory\s+"/home/\*/hi">$}) }
end

context 'with home set to something' do
let :params do
{
home: '/u'
}
end

it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/u/\*/public_html$}) }
it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*<Directory\s+"/u/\*/public_html">$}) }
end

context 'with path set to something' do
let :params do
{
Expand Down
4 changes: 2 additions & 2 deletions templates/mod/userdir.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<% if $disable_root { -%>
UserDir disabled root
<% } -%>
UserDir <%= $_userdir %>
UserDir <%= $userdir %>

<%- if !$unmanaged_path { -%>
<Directory "<%= $_path %>">
<Directory "<%= $path %>">
AllowOverride <%= $overrides.join(' ') %>
Options <%= $options.join(' ') %>
<Limit GET POST OPTIONS>
Expand Down