Issue #11055 has been updated by Garrett Honeycutt.

Check out this mysql::do definition - 
https://github.com/ghoneycutt/puppet-mysql/blob/master/manifests/init.pp#L22

It uses exec's to run mysql commands and creates files in a given directory to 
keep state on which execs have run. This makes dealing with a DB idempotent.

A lot of exec's you might be used to seeing interact with the filesystem where 
the creates attribute checks some symptom of your change, while others such as 
those used by mysql::do interact with a database which is more opaque.

There are other times you would want to do this, such as running commands that 
interact with binary data, or those that contact other systems/API's.

Because of this ubiquitous need to track this type of thing, we need a config 
setting for it. 
----------------------------------------
Feature #11055: directory needed for exec's to hold output for creates attribute
https://projects.puppetlabs.com/issues/11055

Author: Garrett Honeycutt
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


The example to demonstrate the creates attribute from our documentation is as 
follows as places the output in an arbitrary location.
<pre>
exec { "tar -xf /Volumes/nfs02/important.tar":
    cwd => "/var/tmp",
    creates => "/var/tmp/myfile",
    path => ["/usr/bin", "/usr/sbin"]
}
</pre>

In order to keep state with exec's, I have been creating a directory under 
puppet's directory tree with a puppet class and including that in every module 
that uses exec and needs to keep state with the creates attribute. This does 
not scale across puppet distributions and plunges the modules into dependency 
hell.

The fix would be to have something similar to $module_path, so that one could 
specify the directory in puppet.conf and access it in their manifests via a 
variable. This solves the dependency issue with modules and allows packagers to 
place the directory where it makes sense for their distribution.

Then the above code might look like
<pre>
exec { "tar -xf /Volumes/nfs02/important.tar":
    cwd => "/var/tmp",
    creates => "$exec_state_path/myfile",
    path => ["/usr/bin", "/usr/sbin"]
}
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to