diff --git a/user/scripts/update-classes.rb b/user/scripts/update-classes.rb index 940c534..fcf8e4a 100755 --- a/user/scripts/update-classes.rb +++ b/user/scripts/update-classes.rb @@ -59,7 +59,7 @@ conn.search(basedn, LDAP::LDAP_SCOPE_SUBTREE, 'objectClass=posixAccount', # create user class if entry['uid'][0] !~ /.*\$.*/ print "class user::" + entry['uid'][0] + " inherits user::virtual {\n" - print " realize(Newuser['" + entry['uid'][0] + "'])\n" + print " realize(User::Newuser['" + entry['uid'][0] + "'])\n" groups.each do |group| print " realize(Group['" + group + "'])\n" end diff --git a/user/scripts/update-virtual.rb b/user/scripts/update-virtual.rb index ed8a400..f8eafbe 100755 --- a/user/scripts/update-virtual.rb +++ b/user/scripts/update-virtual.rb @@ -41,41 +41,42 @@ f.close print < 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, - } + 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, - } - } + + 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 @@ -96,7 +97,7 @@ conn.search(basedn, LDAP::LDAP_SCOPE_SUBTREE, 'objectClass=posixAccount', } print "\n" - print " @newuser { '%s':\n" % entry['uid'][0] + print " @user::newuser { '%s':\n" % entry['uid'][0] print " uid => '%s',\n" % entry['uidNumber'][0] print " gid => '%s',\n" % entry['gidNumber'][0] begin