On Fri, Oct 26, 2012 at 06:55:32AM -0700, Dave Mankoff wrote:
> Howdy. I feel like I am missing something really simply with regards to the 
> way that Puppet works and I am wondering if someone can point me in the 
> write direction.
> 
> I have written a class that downloads, uncompresses, compiles, and installs 
> Python from source. So far so good. The problem is that it only needs to do 
> this once, when Python is not already in place (or some other custom 
> indicator of the Python version). I have my 3 calls to exec doing their 
> checks just fine, but my calls to wget::fetch and archive::untar both fire 
> during every apply. Specifically, archive::untar takes about 30 seconds to 
> run and I'd prefer it if it only ran conditionally. 
> 
> What is the best way to make sure that this code:
> 
>   wget::fetch { "python-${version}":
>     source => 
> "http://python.org/ftp/python/${version}/Python-${version}.tgz";,
>     destination => "/tmp/Python-${version}.tgz",
>   }
> 
>   archive::untar {"/tmp/python-${version}":
>     source => "/tmp/Python-${version}.tgz",
>     compression => 'gz',
>     rootdir => "Python-${version}",
>     require => Wget::Fetch["python-${version}"],
>   }
> 
> only runs when some condition is met? I can easily put a custom file in 
> place to look for, but how do I make these commands dependent on its 
> absence? I tried making such a file and subscribing to it, but these 
> commands still ran each time.
> 

You don't tell us how wget::fetch is implemented so I can only guess
that there is an exec resource in there? The wget::fetch resource is
*always* evaluated so you have to make sure that the exec resource inside
does not do anything (the exec resource has a `creates` parameter you
can point to a file. If this file is present the command specified by
the `command´ parameter will not run).

Is there a reason why you do not install python as a package or build a
package your own?

-Stefan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to