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

WIP: Add selinux_clear_context_cache type #317

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
25 changes: 25 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ _Private Classes_

**Resource types**

* [`selinux_clear_context_cache`](#selinux_clear_context_cache): A simple metaresource type that invalidates the SELinux default file context cache when refreshed
* [`selinux_fcontext`](#selinux_fcontext): Manage SELinux fcontext definitions. You should use selinux::fcontext instead of this directly.
* [`selinux_fcontext_equivalence`](#selinux_fcontext_equivalence): Manage SELinux fcontext equivalence definitions. You should use selinux::fcontext instead of this directly.
* [`selinux_permissive`](#selinux_permissive): Manage SELinux permissive types.
Expand Down Expand Up @@ -629,6 +630,30 @@ Default value: `undef`

## Resource types

### selinux_clear_context_cache

A simple metaresource type that invalidates the SELinux default file context cache when refreshed

#### Examples

##### Using the type

```puppet
package {'foo': ensure => installed }
~> selinux_clear_context_cache {'clear the selinux cache after installing foo':}
-> Class['foo::config']
```

#### Parameters

The following parameters are available in the `selinux_clear_context_cache` type.

##### `name`

namevar

Arbitary name of the resource instance. Only used for uniqueness.

### selinux_fcontext

Manage SELinux fcontext definitions. You should use selinux::fcontext instead of this directly.
Expand Down
25 changes: 25 additions & 0 deletions lib/puppet/type/selinux_clear_context_cache.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'puppet/util/selinux'

Puppet::Type.newtype(:selinux_clear_context_cache) do
desc <<-DOC
@summary
A simple metaresource type that invalidates the SELinux default file context cache when refreshed.

@example Using the type
package {'foo': ensure => installed }
~> selinux_clear_context_cache {'clear the selinux cache after installing foo':}
-> Class['foo::config']

DOC
newparam :name do
desc 'Arbitary name of the resource instance. Only used for uniqueness.'
isnamevar
end

def refresh
return unless Puppet::Util::SELinux.selinux_support?

Puppet.debug 'Clearing Selinux default file context cache'
Selinux.matchpathcon_fini
end
end