package { 'foo':
ensure => held}
package { 'foo':ensure => '0.4',hold => false}
package { 'foo':ensure => held,version => '0.4',}
file {'/foo':ensure => file,}file {'/foo':ensure => directory,}
directory {'/foo':ensure => present}
In my discussion with @adrienthebo on my pull request: https://github.com/puppetlabs/puppet/pull/2309 I raised the question of what should be the allowable or suggested values for the ensure property?My pull request separated out the hold state into a separate property:before:package { 'foo':
ensure => held}after:package { 'foo':ensure => '0.4',hold => false}@adrienthebo suggested I separate out the version instead:package { 'foo':ensure => held,version => '0.4',}@adrienthebo's suggestion is certianly doable, my question is whether the puppet community has come to a consensus on what values the ensure property should have?
In general my experience has been that adding additional values to ensure for resources makes using a resource less intuitive. For instance I find the file resource has a confusing interface because of the way it abuses the ensure property:file {'/foo':ensure => file,}file {'/foo':ensure => directory,}I would rather have explicit resources:directory {'/foo':ensure => present}What are the communities thoughts?
The language reference describes 'ensure' as managing "the most fundamental aspect of the resource on the target system." For many types, simple presence or absence fits that description, but I don't necessarily call it abuse to support finer gradations of "present", as File does. On the other hand, there are types, such as Mount, that do seem to commingle primary and secondary attributes in their collection of ensure values. That presents both problems on several levels.
Additionally, there are types for which the standard term 'present' is distinctly less meaningful than an alternative term. Going back to Mount for an example, the ensure value 'defined' is much more intuitive to me for that type than the equivalent 'present'. That would be the case even if the the mount state (mounted / unmounted) were pulled out of ensure into its own property, as it probably should be.
With respect to Packages, I am inclined to say that whether a package is 'held' should be managed as a separate property because, as I understand it, it models a flag that can be twiddled for an installed package. That's not nearly so fundamental as the package version -- different versions of the "same" package are in many ways entirely different packages. Perhaps the package version might be better modeled as a separate attribute, too, but that's much less clear cut.
File is another interesting study. As I wrote earlier, I disagree that it is an abuse for that type to support ensure values identifying the type of File. The File type doe shave its share of problems, but to a large extent I think they spring from the ubiquity of files in the UNIX design. In the past I have discussed the possibility of a separate Directory type, I am somewhat dubious of that idea's practical merit. I would be willing to entertain the idea of describing the type of file with a separate property, but even there I'm not persuaded.
Hey,As far as package is concerned I prefer Adrien's suggestion of ensure => held, version => 0.4. This is entirely personal but I think ensure is a good place to model the 'state' of a package and when it comes to apt that state is either held, removed, purged or installed. I would go as far as to say that 'ensure => latest' should not exist, it should be 'ensure => installed with version => latest'.If I think about it in English I'd say "I want the latest version of this package installed" which is why the mapping "version => latest" makes more sense to me as does an 'ensure => installed'. I would also say something like "I want nginx held at 1.4.7" which fairly easily translates to "ensure => held, version => 1.4.7". This specific use-case of holding a version isn't even possible with the current package type because of how the apt provider works, it will hold the current installed version, you can't request it to install a specific version and hold that one except for messing with apt policies.I have no idea how this translates to other package managers though.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/feb80058-5a45-46f0-8b05-cb86b54b645c%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
That is a problem puppet could alert on, or puppet could just let the managed OS tell whether that state is permissible.
I may be missing something, but that can never be a consistent single state on any platform.
A path will always lead to a file *or* a directory *or* a symlink.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/b7fb208b-9990-4aec-88dd-463c1551c5ee%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/8af42114-8ec1-4d85-9000-096031d98e9a%40googlegroups.com.
On 04/01/2014 01:44 AM, Trevor Vaughan wrote:
> I have to say that I like 'hold' better than 'held' based on the way I
> would actually read this.
Right, and I don't agree about John's point about property names. There
are counter-examples that work very well like service/enable,
file/purge, file/recurse etc. The inconsistency with yumrepo/enabled is
unfortunate.
When I read those, I think 'imperative', which really is what the
manifest represents. Ensure this! Hold that! :-)
I have to say that I like 'hold' better than 'held' based on the way I would actually read this.This is package 'foo'.I want to ensure that it is installed.
I want the version to be '1.1'.
I want to hold it fast.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/88eefe32-2c56-4837-896f-ea0373a92088%40googlegroups.com.
Are hashes as property values out of the question?
eg.
ensure => {
installed => true,
version => '1.2.3',
held => true,
bikeshed => 'green',
}
R.