Feature #432
Manage user home dirs
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 0.22.2 | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
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.
History
Updated by Luke Kanies over 5 years ago
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.
Updated by over 5 years ago
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.
Updated by Luke Kanies over 5 years ago
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.
Updated by Tim Stoop over 5 years ago
Hm, is this then what you want? Seems to simple, but might work?
Updated by Luke Kanies about 5 years ago
- Status changed from 1 to 2
Updated by Luke Kanies about 5 years ago
- Status changed from 2 to Closed
- 7 set to fixed
Applied most of these patches, with significant modifications, in r2238. Purging is still not yet supported.