Skip to content

Commit

Permalink
Merge pull request #697 from ckaenzig/vhost-docroot_mode
Browse files Browse the repository at this point in the history
add docroot_mode parameter to vhost
  • Loading branch information
Ashley Penney committed May 1, 2014
2 parents 7369205 + 1fa0d70 commit edd20d0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ Sets group access to the docroot directory. Defaults to 'root'.

Sets individual user access to the docroot directory. Defaults to 'root'.

#####`docroot_mode`

Sets access permissions of the docroot directory. Defaults to 'undef'.

#####`error_log`

Specifies whether `*_error.log` directives should be configured. Defaults to 'true'.
Expand Down
2 changes: 2 additions & 0 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
$add_listen = true,
$docroot_owner = 'root',
$docroot_group = $::apache::params::root_group,
$docroot_mode = undef,
$serveradmin = undef,
$ssl = false,
$ssl_cert = $::apache::default_ssl_cert,
Expand Down Expand Up @@ -252,6 +253,7 @@
ensure => directory,
owner => $docroot_owner,
group => $docroot_group,
mode => $docroot_mode,
require => Package['httpd'],
}
}
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ class { 'apache': }
docroot => '/tmp/test',
docroot_owner => 'test_owner',
docroot_group => 'test_group',
docroot_mode => '0750',
}
EOS
apply_manifest(pp, :catch_failures => true)
Expand All @@ -468,6 +469,7 @@ class { 'apache': }
it { should be_directory }
it { should be_owned_by 'test_owner' }
it { should be_grouped_into 'test_group' }
it { should be_mode '0750' }
end
end

Expand Down
6 changes: 4 additions & 2 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1098,16 +1098,18 @@
expect { subject }.to raise_error(Puppet::Error, /'error_log_file' and 'error_log_pipe' cannot be defined at the same time/)
end
end
describe 'when docroot owner is specified' do
describe 'when docroot owner and mode is specified' do
let :params do default_params.merge({
:docroot_owner => 'testuser',
:docroot_group => 'testgroup',
:docroot_mode => '0750',
}) end
it 'should set vhost ownership' do
it 'should set vhost ownership and permissions' do
should contain_file(params[:docroot]).with({
:ensure => :directory,
:owner => 'testuser',
:group => 'testgroup',
:mode => '0750',
})
end
end
Expand Down
3 changes: 2 additions & 1 deletion tests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
docroot => '/var/www/first',
}

# Vhost with different docroot owner/group
# Vhost with different docroot owner/group/mode
apache::vhost { 'second.example.com':
port => '80',
docroot => '/var/www/second',
docroot_owner => 'third',
docroot_group => 'third',
docroot_mode => '0770',
}

# Vhost with serveradmin
Expand Down

0 comments on commit edd20d0

Please sign in to comment.