sudo: File name fix for sudoer

This commit is contained in:
Ossi Salmi 2013-11-27 08:22:51 +02:00
parent e952bc4920
commit ee30f9e1ad

View file

@ -41,8 +41,8 @@ class sudo {
#
# === Parameters
#
# $name:
# User or group. Prefix group name with %.
# $who:
# User or group. Prefix group name with %. Defaults to $name.
# $where:
# Defaults to ALL.
# $as_whom:
@ -50,9 +50,22 @@ class sudo {
# $what:
# Defaults to ALL.
#
define sudo::sudoer($where="ALL", $as_whom="ALL", $what="ALL") {
define sudo::sudoer(
$who=undef,
$where="ALL",
$as_whom="ALL",
$what="ALL"
) {
file { "/etc/sudoers.d/${name}":
if ! $who {
$who_real = $name
} else {
$who_real = $who
}
$name_real = regsubst($name, '%', '_')
file { "/etc/sudoers.d/${name_real}":
ensure => present,
mode => "0440",
owner => "root",
@ -60,7 +73,7 @@ define sudo::sudoer($where="ALL", $as_whom="ALL", $what="ALL") {
"openbsd" => "wheel",
default => "root",
},
content => "${name}\t${where}=(${as_whom})\t${what}\n",
content => "${who_real}\t${where}=(${as_whom})\t${what}\n",
require => File["/etc/sudoers"],
}