On Thu, 01 Sep 2011 12:14:51 -0400, Guy Matz wrote: > > Hi, > I have inherited some code to create users that doesn't work when removing > users . . . it's listed below. It works for adding users, but when it > comes to removing users I get: > err: /Stage[main]/Common/Common::Mkuser[oshi.apen]/Group[oshi.apen]/ensure: > change from present to absent failed: Could not delete group oshi.apen: > Execution of '/usr/sbin/groupdel oshi.apen' returned 8: groupdel: cannot > remove the primary group of user 'oshi.apen' > > User requires the Group to be defined, which, again, works for adding users, > but not removing. My instinct is to have a condition test for remove/add > and set the dependencies from there, but that seems klunky and inelegant. > Anyone have any better code for adding/removing users? A suggestion? > > Thanks a lot, > Guy >
Don't really have anything to help you directly right now, but this kind of problem isn't just limited to users & groups, though it's certainly the most common. The problem is that Puppet really only has one way to specify a dependency (resource A must come before resource B). We do have plans to address this, but it's a little ways off (months, not years). The idea is to add "above" & "below" style relationships (think building blocks). When applying resources that are building/creating you need to go from the bottom up, and when applying resources that are destroying/removing, you need to go from the top down. It's currently listed as the "Above/below relationships" item in the Open Source Team's roadmap[1]. [1] http://projects.puppetlabs.com/projects/puppet/wiki/Road_map -- Jacob Helwig ,---- | Join us for PuppetConf, September 22nd and 23rd in Portland, OR | http://bit.ly/puppetconfsig `----
signature.asc
Description: Digital signature