-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#86) Enforce permissions on created files
* Add attributes for enforcing ownership and permissions on created files * Add data types to all class and defined type parameters * Move documentation to Puppet Strings * Add generated REFERENCE.md * Add rspec tests for `kmod::option`, new parameters, etc. * Bump stdlib dependency to 5.0.0 (for `Stdlib::Filemode` type) Fixes #86
- Loading branch information
Showing
18 changed files
with
1,204 additions
and
114 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
kmod::owner: 'root' | ||
kmod::group: 'root' | ||
kmod::directory_mode: '0755' | ||
kmod::file_mode: '0644' | ||
kmod::exe_mode: '0755' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
# @summary Set a kernel module as blacklisted. | ||
# | ||
# == Definition: kmod::blacklist | ||
# | ||
# Set a kernel module as blacklisted. | ||
# | ||
# Parameters: | ||
# - *ensure*: present/absent; | ||
# - *file*: optionally, set the file where the stanza is written. | ||
# | ||
# Example usage: | ||
# @param ensure State of the setting | ||
# @param file File to manage | ||
# @param owner Owner of managed file | ||
# @param group Group of managed file | ||
# @param mode Mode of managed file | ||
# | ||
# @example | ||
# kmod::blacklist { 'pcspkr': } | ||
# | ||
define kmod::blacklist ( | ||
$ensure=present, | ||
$file='/etc/modprobe.d/blacklist.conf', | ||
Enum['present', 'absent'] $ensure = 'present', | ||
Stdlib::Unixpath $file = '/etc/modprobe.d/blacklist.conf', | ||
Optional[String[1]] $owner = undef, | ||
Optional[String[1]] $group = undef, | ||
Optional[Stdlib::Filemode] $mode = undef, | ||
) { | ||
include kmod | ||
|
||
kmod::setting { "kmod::blacklist ${title}": | ||
ensure => $ensure, | ||
module => $name, | ||
file => $file, | ||
category => 'blacklist', | ||
owner => $owner, | ||
group => $group, | ||
mode => $mode, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
# @summary Set a kernel module as installed | ||
# | ||
# == Definition: kmod::install | ||
# | ||
# Set a kernel module as installed. | ||
# | ||
# Parameters: | ||
# - *ensure*: present/absent; | ||
# - *command*: optionally, set the command associated with the kernel module; | ||
# - *file*: optionally, set the file where the stanza is written. | ||
# | ||
# Example usage: | ||
# @param ensure State of the setting | ||
# @param command Command associated with the kernel module | ||
# @param file File where the stanza is written | ||
# @param owner Owner of managed file | ||
# @param group Group of managed file | ||
# @param mode Mode of managed file | ||
# | ||
# @example | ||
# kmod::install { 'pcspkr': } | ||
# | ||
define kmod::install ( | ||
$ensure=present, | ||
$command='/bin/true', | ||
$file="/etc/modprobe.d/${name}.conf", | ||
Enum['present', 'absent'] $ensure = 'present', | ||
String[1] $command = '/bin/true', | ||
Stdlib::Unixpath $file = "/etc/modprobe.d/${name}.conf", | ||
Optional[String[1]] $owner = undef, | ||
Optional[String[1]] $group = undef, | ||
Optional[Stdlib::Filemode] $mode = undef, | ||
) { | ||
include kmod | ||
|
||
kmod::setting { "kmod::install ${title}": | ||
ensure => $ensure, | ||
module => $name, | ||
file => $file, | ||
category => 'install', | ||
option => 'command', | ||
value => $command, | ||
owner => $owner, | ||
group => $group, | ||
mode => $mode, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,41 @@ | ||
# = Define: kmod::alias | ||
# @summary Manage kernel module options | ||
# | ||
# == Example | ||
# | ||
# kmod::option { 'bond0': | ||
# option => 'bonding', | ||
# } | ||
# @param option Option to manage | ||
# @param value Value of kernel module option | ||
# @param module Kernel module to manage | ||
# @param ensure State of the option | ||
# @param file File to manage | ||
# @param owner Owner of managed file | ||
# @param group Group of managed file | ||
# @param mode Mode of managed file | ||
# | ||
# @example | ||
# kmod::option { 'bond0 mode': | ||
# module => 'bond0', | ||
# option => 'mode', | ||
# value => '1', | ||
# } | ||
define kmod::option ( | ||
$option, | ||
$value, | ||
$module = $name, | ||
$ensure = 'present', | ||
$file = undef, | ||
String[1] $option, | ||
Scalar $value, | ||
String[1] $module = $name, | ||
Enum['present', 'absent'] $ensure = 'present', | ||
Stdlib::Unixpath $file = "/etc/modprobe.d/${module}.conf", | ||
Optional[String[1]] $owner = undef, | ||
Optional[String[1]] $group = undef, | ||
Optional[Stdlib::Filemode] $mode = undef, | ||
) { | ||
include kmod | ||
|
||
$target_file = $file ? { | ||
undef => "/etc/modprobe.d/${module}.conf", | ||
default => $file, | ||
} | ||
|
||
kmod::setting { "kmod::option ${title}": | ||
ensure => $ensure, | ||
module => $module, | ||
category => 'options', | ||
file => $target_file, | ||
file => $file, | ||
option => $option, | ||
value => $value, | ||
owner => $owner, | ||
group => $group, | ||
mode => $mode, | ||
} | ||
} |
Oops, something went wrong.