The notify resource here would be perfect _if_ it supported
'refreshonly' ... which unfortunately it does not. (possibly a good
feature request though ...).

A work around is to use something that does support refreshonly ...
namely 'exec'.

file { "/tmp/foo":
  content => "foo",
  notify => Exec["asdf"],
}
exec { "asdf":
  command => "/bin/echo foo",
  logoutput => true,
  refreshonly => true,
}

This will at least print something to the screen only when the file changes.

ken.

On Fri, Oct 28, 2011 at 12:31 PM, Ralf Groß <[email protected]> wrote:
> Hi,
>
> I've the following class which- depending on the department - changes
> the krb5.conf. How could I use notice to only be used if the file gets
> changed/updated? I don't see a way to use notice in the file resource
> directly.
>
>
> class stz_krb5 {
>
>        notice("/etc/krb5.conf Check host: $::hostname department:
> $stz_krb5::DEPARTMENT")
>
>        $SOURCE_FILE="puppet://$puppet_fileserver/files/etc/krb5.conf"
>        $DST_FILE="/etc/krb5.conf"
>
>
>  if ( $stz_krb5::DEPARTMENT != 'foo' ){
>                if ( $stz_krb5::DEPARTMENT != bla' ){
>                                file { "krb5.conf":
>                                name => $DST_FILE,
>                                source => $SOURCE_FILE,
>                                mode => 644,
>                        }
>                } else {
>                        notice("Not updating krb5.conf - this is a
> bla. host: $::hostname department: $stz_krb5::DEPARTMENT")
>                }
>        } else {
>                notice("Not updating krb5.conf - this is a foo System.
> host: $::hostname  department: $stz_krb5::DEPARTMENT")
>        }
> }
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>
>

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

Reply via email to