I just discovered I cannot resource-purge yumrepos -- Is there another way ?

279 views
Skip to first unread message

Dan White

unread,
Jan 23, 2012, 10:09:49 AM1/23/12
to Pupper Users Mailing List
I added a bunch of yumrepo resources to my node definitions and thought I'd finish it with a

resources { 'yumrepo': purge => true, }

But when I tried to run it, I get this:

err: Failed to apply catalog: Parameter purge failed: Purging is only supported on types that accept 'ensure' at /etc/puppet/manifests/nodes/....

Is there an alternative, non-messy way to do what that statement should do for me ?


“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

Stefan Schulte

unread,
Jan 23, 2012, 1:10:27 PM1/23/12
to Pupper Users Mailing List
On Mon, Jan 23, 2012 at 03:09:49PM +0000, Dan White wrote:
> I added a bunch of yumrepo resources to my node definitions and thought I'd finish it with a
>
> resources { 'yumrepo': purge => true, }
>
> But when I tried to run it, I get this:
>
> err: Failed to apply catalog: Parameter purge failed: Purging is only supported on types that accept 'ensure' at /etc/puppet/manifests/nodes/....
>

While I don't have a workaround for you, there is a featurerequest to
accomplish resource purging

http://projects.puppetlabs.com/issues/9293

-Stefan

Dan White

unread,
Jan 23, 2012, 1:54:34 PM1/23/12
to puppet...@googlegroups.com
That the problem is known is a comfort.

I will trash my way around it one way or another, and if I come up with any neato tricks for removal of a repo, I will contact the list and/or the Feature Assignee :)

“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

Eric Sorenson

unread,
Jan 23, 2012, 10:40:02 PM1/23/12
to puppet...@googlegroups.com
This is sort of hackish but not too bad... set a list of file resources that are the resultant names of the /etc/yum.repos.d/<blah>.repo files, and purge everything else in that directory.

class yum::cleanup {
    # shorthand for the repo directory
    $rd = "/etc/yum.repos.d"

    # clean the yum.repos.d directory of any non-managed files
    file { "$rd": ensure => directory, purge => true, recurse => true }

    # NOTE: If you add a new yumrepo, make a matching file resource here!
    file { [ "$rd/local.repo",
             "$rd/os.repo",
             "$rd/base.repo", ] : 
                ensure => present, 
         }

}

class yum::repositories {
    require yum::cleanup

    yumrepo { "os"

   .... etc ...

    }

}

Dan White

unread,
Jan 24, 2012, 9:25:00 AM1/24/12
to puppet...@googlegroups.com
Thank you.
Simple enough to ignore the hack-ish nature :)

Looks like it will do the job

All it needs are a few yum commands to run whenever the file changes to refresh the local databse.

I will tinker with that and report back to the list.

Pay It Forward !
Share & Enjoy !

“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/62XjufqJOh8J.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>

Reply all
Reply to author
Forward
0 new messages