puppetlabs/puppet — pull request #1387 by stschulte (2013-01-13 15:15:04+00:00)
Title: #11675 implement expiry retrieve for useradd

The userprovider `pw`, `aix` and `useradd` claim to implenent the feature `manages_expiry`.

At least the `useradd` provider does only implement to change the expiry; the retrieval of the current value is not implemented. This commit series implements such a method.

Please note that the `expiry` property is special in different ways:

1) Different providers need different notations of the date. The `useradd` provider accepts 'YYYY-MM-DD" while the `pw` provider uses "DD-MM-YYYY". The value "no expiry" is also different. The `pw` command seems to accept '00-00-0000' while the usermod command accepts an emty string (Solaris) or a single space (Linux) as a value for "no expiry". But to be able to use the same `user` resource on different systems, the providers have to provide one unique interface. I've expanded the `nameservice` provider (parent of `useradd` and `pw`) to be able to archive that and modified the `useradd` provider to use these features. The `useradd` provider now converts an expiry setting of `:absent` into `' '` or `''` depending on the target system. This means that the `pw` and `aix` may still be broken -- but there are not more broken than before the commit series.

2) The `expiry` property can be set with `usermod`, so we don't have to write our own set method (the `objectadd` parent class already takes care of it) but the property cannot be retrieved with `Etc.getpwnam`. We therefore have to write our own get method. This has now be implemented for the `useradd` provider. I am not familiar with FreeBSD or AIX so I don't know how you can check the current expiry date on these systems, so the `pw` and `aix` provider may still be broken -- but there are not more broken than before the commit series.