Perfect!! Thanks Ben. On Tuesday, October 22, 2019 at 11:22:50 PM UTC+1, Ben Ford wrote: > > Hi Dan! > > When you subscribe to another resource like subscribe => > File['/etc/logrotate.d/syslog'], the key is that you're not actually > subscribing to the file on disk. You're subscribing to *another Puppet > resource*, of type File and with a title of '/etc/logrotate.d/syslog'. Any > time that Puppet makes changes to the resource, that notification will > trigger. > > Here's a graphic that shows how the relationship works. References in the > Puppet code point to resource declarations in Puppet code, not to the > artifacts on the system that are managed by those resource declarations. > > [image: reference_manifest.png] > > This means that unless you're actually managing that file with Puppet > code, the relationship won't work. > > > On Tue, Oct 22, 2019 at 2:27 PM Dan Crisp <[email protected] <javascript:>> > wrote: > >> Hi, >> >> I'm seeing the following error when running the agent on a server: >> >> Error: Could not retrieve catalog from remote server: Error 500 on >> SERVER: Server Error: Could not find resource >> 'File[/etc/logrotate.d/syslog]' in parameter 'subscribe' (file: >> /etc/puppetlabs/code/environments/production/modules/base/manifests/syslog.pp, >> >> line: 21) on node lhcsrvmtrrsl01.fixnetix.com >> >> I want the logrotate command to run every time there is a change to the >> /etc/logrotate.d/syslog file. Thought this could be achieved via the >> following: >> >> exec { 'LogRotate': >> path => '/usr/sbin', >> command => 'logrotate -vdf /etc/logrotate.d/syslog 2>/dev/null', >> subscribe => File['/etc/logrotate.d/syslog'], >> refreshonly => true, >> } >> >> I can't work out why the agent is complaining re Could not find resource >> 'File[/etc/logrotate.d/syslog]' >> >> # puppet resource file /etc/logrotate.d/syslog >> file { '/etc/logrotate.d/syslog': >> ensure => 'file', >> content => '{md5}e59f6816e9fcd21174501313720c660f', >> ctime => '2019-10-22 21:36:25 +0100', >> group => 0, >> mode => '0644', >> mtime => '2019-10-22 21:36:25 +0100', >> owner => 0, >> selrange => 's0', >> selrole => 'object_r', >> seltype => 'etc_t', >> seluser => 'system_u', >> type => 'file', >> } >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-users/482e3b96-c20c-4517-85c9-dc437f28c56c%40googlegroups.com >> >> <https://groups.google.com/d/msgid/puppet-users/482e3b96-c20c-4517-85c9-dc437f28c56c%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >
-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5f460232-eadf-441a-983e-7651abcd342b%40googlegroups.com.
