Puppet: System Administration Automated

Support

Ticket #432 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Manage user home dirs

Reported by: kadlec@sunserv.kfki.hu Assigned to: luke
Priority: normal Milestone: grover
Component: types Version:
Severity: normal Keywords: patch
Cc: Triage Stage:
Attached Patches: Complexity:

Description

The attached patch adds the 'managehome' flag to the user type. Setting it to true the flag '-m' is added to 'useradd' and '-r' to 'userdel' programs respectively, i.e. create or delete the user home directory.

Attachments

puppet-user.patch (2.3 kB) - added by mpalmer on 01/15/07 21:20:22.
Patch to add 'managehome' attribute to users
puppet-user.2.patch (2.3 kB) - added by tim on 02/12/07 23:44:46.
A small modification of the original patch
user-homedir.patch (1.4 kB) - added by tim on 02/12/07 23:48:18.
This patch is what I meant, sorry :|

Change History

01/15/07 21:20:22 changed by mpalmer

  • attachment puppet-user.patch added.

Patch to add 'managehome' attribute to users

01/15/07 21:20:55 changed by mpalmer

  • reporter changed from mpalmer to kadlec@sunserv.kfki.hu.

01/15/07 23:49:18 changed by luke

I agree that this functionality is useful and important.

The patch could be better in a couple of ways. First, the comment no longer has to be quoted because Puppet now does a direct exec instead of using a subshell -- the comment above the quoting code is wrong, which is my fault.

Second, I think that the 'ensure' state should be extended to support two types of deletion -- the current "absent", and a new "purged". Plain "absent" should just remove the user, and "purged" should delete the home directory.

I'm fine accepting it as it is for now (other than the quoting), but when resources have such a big impact on other resources, we want to be pretty careful about destroying information.

01/16/07 09:43:03 changed by kadlec

The quoting is unnecessary - I forgot that no shell is involved at exec.

How could one label by 'ensure' that the user account should be created together with the home directory? Just to find a pair to 'purged' and I'll submit a new patch.

01/16/07 23:25:00 changed by luke

For creating the user, using a parameter is the right option, I think, but 'managehome => true' does not at all imply that a user's home directory will be recursively deleted if the user is deleted, so I think it's appropriate to have an extra 'ensure' value to clearly indicate that deletion is happening.

Basically, ensure => purge should behave almost the same as ensure => absent, except that it should add the "-r" to userdel.

02/12/07 23:44:21 changed by tim

Hm, is this then what you want? Seems to simple, but might work?

02/12/07 23:44:46 changed by tim

  • attachment puppet-user.2.patch added.

A small modification of the original patch

02/12/07 23:48:18 changed by tim

  • attachment user-homedir.patch added.

This patch is what I meant, sorry :|

03/08/07 04:09:36 changed by luke

  • status changed from new to assigned.
  • milestone set to grover.

03/19/07 22:30:00 changed by luke

  • status changed from assigned to closed.
  • resolution set to fixed.

Applied most of these patches, with significant modifications, in [2238]. Purging is still not yet supported.