yumrepo and notify

154 views
Skip to first unread message

Antidot SAS

unread,
Sep 13, 2012, 5:13:21 AM9/13/12
to puppet-users
Hi everyone,


I trying to notify a cache clean when creating a yumrepository:
                yumrepo { 'XXXXXXX':
                    descr    => 'XXXXXX Packages',
                    baseurl  => $url,
                    require  => [ Yum::Key['0b6f8066'], ],
                    gpgcheck => '1',
                    enabled  => '1',
                    notify   => [ Exec['YUM Clean cache'], ],
                }

                exec { 'YUM Clean cache':
                    path        => '/bin:/usr/bin:/usr/local/bin',
                    user        => 'root',
                    logoutput   => true,
                    refreshonly => true,
                    command     => 'yum clean all --verbose',
                }

And I am getting the following error on RedHat 6:
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /var/lib/puppet/lib/facter/meminbytes.rb
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Can't synthesize edge: File[/etc/yum.repos.d/XXX.repo] -notifies- Exec[YUM Clean cache] (param notify)
info: Not using expired catalog for XXXX.fqdn from cache; expired at Wed Sep 12 17:03:31 +0200 2012
notice: Using cached catalog
err: Could not retrieve catalog; skipping run

Any idea what could be the problem?



Regards,
JM

jcbollinger

unread,
Sep 13, 2012, 9:09:46 AM9/13/12
to puppet...@googlegroups.com

My first guess would be a parse-order issue.  Try moving the declaration of the Exec before the declaration of the Yumrepo, or if they are in different classes then make sure the Exec's class is parsed before the Yumrepo's.  My standard way to approach the latter situation would be to have the Yumrepo's class 'include' the Exec's.


John

Antidot SAS

unread,
Sep 13, 2012, 9:42:09 AM9/13/12
to puppet...@googlegroups.com
The exec and the yumrepo are declared in the same manifest even with declaring the exec before, it doesn't help....




--
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/-/aNQO7QnFIngJ.
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.

Antidot SAS

unread,
Sep 13, 2012, 10:35:03 AM9/13/12
to puppet...@googlegroups.com
Ok my bad, finally I taught the error was  the yumrepo but it wasn't. The error appears because of the following:

            file { '/etc/yum.repos.d/XXXXXXX.repo' :
                ensure => absent,
                path   => '/etc/yum.repos.d/XXXXX.repo',
                notify => [ Exec['YUM Clean cache'], ],
            }

So I think the attribut 'ensure => absent' is not a good candidat for notification.

Thx for helping
JM

Peter Brown

unread,
Sep 13, 2012, 8:39:36 PM9/13/12
to puppet...@googlegroups.com
Just as a point, the order things appear in a manifest has no impact
of what "gets executed first".
Its generally random unless you enforce an ordering scheme with the
various ways of doing that. (require and/or resource chaining and
such)
Reply all
Reply to author
Forward
0 new messages