Hacked user module to fix compatilibity with puppet 2.7

This commit is contained in:
Ossi Salmi 2011-12-15 18:00:17 +02:00 committed by Timo Mkinen
parent 30177d3e08
commit 8d123cdb17
6 changed files with 59 additions and 55 deletions

View file

@ -39,46 +39,7 @@ f.readlines.each do |line|
end
f.close
print <<EOF
define user::newuser($uid, $gid, $comment, $home, $shell, $groups=undef, $requiregroups=undef) {
user { "${name}":
ensure => present,
uid => $uid,
gid => $gid,
comment => $comment,
home => $home,
shell => $shell,
groups => $groups,
require => $requiregroups,
notify => $operatingsystem ? {
OpenBSD => [ Exec["user-mod-${name}"],
Exec["user-home-${name}"], ],
default => undef,
}
}
exec { "user-mod-${name}":
command => "usermod -L ldap ${name}",
path => "/sbin:/usr/sbin:/bin:/usr/bin",
refreshonly => true,
require => File["/etc/login.conf"],
}
exec { "user-home-${name}":
command => "umask 077; mkdir -p ${home} && tar cf - . | tar xf - -C ${home} && chown -R ${uid}:${gid} ${home}",
cwd => "/etc/skel",
path => "/sbin:/usr/sbin:/bin:/usr/bin",
creates => "${home}",
refreshonly => true,
}
}
class user::virtual {
EOF
print "class user::virtual {\n"
conn.search(basedn, LDAP::LDAP_SCOPE_SUBTREE, 'objectClass=posixAccount',
['uid', 'uidNumber', 'gidNumber', 'gecos', 'homeDirectory',