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

Add acceptance test and documentation for file autorequire #113

Merged
merged 1 commit into from
Jan 26, 2022
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
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@


## Description
This plugin module provides a way to set POSIX 1.e (and other standards) file ACLs via Puppet.
This plugin module provides a way to set POSIX 1.e (and other standards) file
ACLs via Puppet. It provides one class, `posix_acl::requirements`, which
installs the acl package. It provides `setfacl` and `getfacl`. Those binaries
are used by the Puppet Provider. You don't have to use the class, but the
binaries need to be present. Puppet will autorequire the package. That means
that all posix_acl resources will be applied after the acl package is
installed, if the package resource is in the catalog.

The type also has logic to autorequire filepaths. It will check the catalog for
the path where you want to set ACLs and any paths above. If recursive is set to
true, also ascendings paths are autorequired.

## Setup

Expand Down
30 changes: 16 additions & 14 deletions spec/acceptance/basic_posix_acl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
user { 'blub':
ensure => 'present',
}
file { '/opt/test':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test':
posix_acl { '/opt/test':
action => exact,
permission => [
'user::rwx',
Expand All @@ -30,6 +24,13 @@
recursive => false,
require => User['blub'],
}
# we declare the file resource after posix_acl to verfiy autorequire works
file { '/opt/test':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET
end
end
Expand All @@ -43,13 +44,7 @@
user { 'blub2':
ensure => 'present',
}
file { '/opt/test2':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test2':
posix_acl { '/opt/test2':
action => exact,
permission => [
'user::rwx',
Expand All @@ -67,6 +62,13 @@
recursive => false,
require => User['blub2'],
}
# we declare the file resource after posix_acl to verfiy autorequire works
file { '/opt/test2':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET2
end
end
Expand Down
30 changes: 16 additions & 14 deletions spec/acceptance/purge_posix_acl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
user { 'blub':
ensure => 'present',
}
file { '/opt/test':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test':
posix_acl { '/opt/test':
action => exact,
permission => [
'user::rwx',
Expand All @@ -30,6 +24,13 @@
recursive => false,
require => User['blub'],
}
# we declare the file resource after posix_acl to verfiy autorequire works
file { '/opt/test':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET
end
end
Expand All @@ -40,13 +41,7 @@
let(:manifest) do
<<-PUPPET2
include posix_acl::requirements
file { '/opt/test5':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test5':
posix_acl { '/opt/test5':
action => exact,
permission => [
'user::rwx',
Expand All @@ -61,6 +56,13 @@
provider => posixacl,
recursive => false,
}
# we declare the file resource after posix_acl to verfiy autorequire works
file { '/opt/test5':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET2
end
end
Expand Down
45 changes: 24 additions & 21 deletions spec/acceptance/updating_posix_acl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
user { ['blub', 'blub2']:
ensure => 'present',
}
file { '/opt/test3':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test3':
posix_acl { '/opt/test3':
action => exact,
permission => [
'user::rwx',
Expand All @@ -30,6 +24,13 @@
recursive => false,
require => User['blub'],
}
# we declare the file resource after posix_acl to verfiy autorequire work
file { '/opt/test3':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET
end
end
Expand All @@ -43,13 +44,7 @@
user { ['blub', 'blub2']:
ensure => 'present',
}
file { '/opt/test3':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test3':
posix_acl { '/opt/test3':
action => set,
permission => [
'user::rwx',
Expand All @@ -62,6 +57,13 @@
recursive => false,
require => User['blub2'],
}
# we declare the file resource after posix_acl to verfiy autorequire works
file { '/opt/test3':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET
end
end
Expand All @@ -75,13 +77,7 @@
user { ['blub', 'blub2']:
ensure => 'present',
}
file { '/opt/test3':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
-> posix_acl { '/opt/test3':
posix_acl { '/opt/test3':
action => exact,
permission => [
'user::rwx',
Expand All @@ -94,6 +90,13 @@
recursive => false,
require => User['blub2'],
}
# we declare the file resource after posix_acl to verfiy autorequire works
file { '/opt/test3':
ensure => directory,
owner => root,
group => root,
mode => '2770',
}
PUPPET
end
end
Expand Down