Yep, the "creates" makes exec know that the command given will create that
file and won't run once it exists.  This is similar to using onlyif/unless w/
something like "test -e /etc/yum.repo.d/blah.repo".

I have the requires setup on the package resources like that so the -release
RPMs are installed, then they will maintain the release file and keep it
updated (ensure => latest).

-Doug

On 09/13/2011 11:37 AM, Tim Coote wrote:
> Thanks. I'll try that. I had a simpler model using exec, but found that it
> kept being run and failing.
> 
> How do I set up the dependencies such that the exec only triggers as needed
> (is that what creates=> achieves?)
> 
> Tim
> 
> On 13 September 2011 16:16, Doug Warner <d...@warner.fm
> <mailto:d...@warner.fm>> wrote:
> 
>     On 09/13/2011 09:47 AM, Tim Coote wrote:
>     > Hullo
>     > I'd like to add the various rpmfusion repos to my puppet manifests. Is
>     > it possible to use yum/rpm to do this directly from the rpmfusion
>     > site, using the downloadable rpm (from the rpmfusion web site):
>     >
>     > yum localinstall --nogpgcheck
>     >
>     
> http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
>     >
>     > Otherwise, I've got to define the repo using the yumrepo type, which
>     > just seems like a lot of fragile code (the rpm generates 3 repos).
>     >
>     > tia
>     > Tim
>     >
> 
>     Tim,
> 
>     I use this define/exec:
> 
>     ##
>     # creates a repo release file by downloading the $source
>     #
>     # $name: name of repository (creates ${name}.repo file)
>     # $source: URL to *-release rpm
>     define packages::repo_release ($source) {
>            exec { $name:
>                    command =>"/bin/rpm -Uvh ${source}",
>                    creates => "/etc/yum.repos.d/${name}.repo",
>            }
>     }
> 
> 
>     And then I use these instances:
> 
>     packages::repo_release { "rpmfusion-free":
>            source =>
>     
> "http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm";,
>     }
>     packages::repo_release { "rpmfusion-nonfree":
>            source =>
>     
> "http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm";,
>     }
>     package { [
>            "rpmfusion-free-release",
>            "rpmfusion-nonfree-release",
>            ]:
>            ensure => latest,
>            require => [
>                    Packages::Repo_release["rpmfusion-free"],
>                    Packages::Repo_release["rpmfusion-nonfree"],
>            ],
>     }
> 
>     -Doug
> 
> 


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to