Vaidas Jablonskis
2013-Jan-14 18:09 UTC
[Puppet Users] Refresh Exec resource from a File resource without source =>
Hi Guys,
My manifest code looks pretty much like below:
------------
exec { ''sync-business-logic'':
path => "/usr/bin:/bin:${bl_path}",
cwd => $bl_path,
command => ''sync-bl.pl'',
refreshonly => true,
subscribe => File[$sync_bl_files],
}
file { $sync_bl_files:
ensure => file,
require => Package[$dpx::package_name],
}
-------------
As you can see, my File[$sync_bl_files] resource does not have any source,
because these files are installed by a package. These files change with a
new version of the package. What I need is to be able to refresh the
Exec[''sync-business-logic''] resource when $sync_bl_files
change.
It does not seem to work if there is no "source =>" specified.
Any ideas?
--
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/-/8HftW4tMIKIJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Ken Barber
2013-Jan-14 18:24 UTC
Re: [Puppet Users] Refresh Exec resource from a File resource without source =>
You probably want an audit field in your file resource, try this
pattern on for size:
# cat /tmp/zzz.pp
file {"/tmp/foo":
ensure => file,
notify => Exec["foo"],
audit => ''content'',
}
exec {"foo":
command => "/usr/bin/true",
refreshonly => true,
}
# echo "foobar" > /tmp/foo
# ./bin/puppet apply /tmp/zzz.pp
Notice: /Stage[main]//File[/tmp/foo]/content: audit change: previously
recorded value {md5}2b00042f7481c7b056c4b410d28f33cf has been changed
to {md5}14758f1afd44c09b7992073ccf00b43d
Notice: /Stage[main]//Exec[foo]: Triggered ''refresh'' from 1
events
Notice: Finished catalog run in 0.13 seconds
# ./bin/puppet apply /tmp/zzz.pp
Notice: Finished catalog run in 0.06 seconds
Otherwise, you could always just notify on the package update.
On Mon, Jan 14, 2013 at 6:09 PM, Vaidas Jablonskis <jablonskis@gmail.com>
wrote:> Hi Guys,
>
> My manifest code looks pretty much like below:
>
> ------------
> exec { ''sync-business-logic'':
> path => "/usr/bin:/bin:${bl_path}",
> cwd => $bl_path,
> command => ''sync-bl.pl'',
> refreshonly => true,
> subscribe => File[$sync_bl_files],
> }
>
> file { $sync_bl_files:
> ensure => file,
> require => Package[$dpx::package_name],
> }
> -------------
>
> As you can see, my File[$sync_bl_files] resource does not have any source,
> because these files are installed by a package. These files change with a
> new version of the package. What I need is to be able to refresh the
> Exec[''sync-business-logic''] resource when $sync_bl_files
change.
>
> It does not seem to work if there is no "source =>" specified.
>
> Any ideas?
>
> --
> 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/-/8HftW4tMIKIJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscribe@googlegroups.com.
> 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 puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Ken Barber
2013-Jan-14 18:25 UTC
Re: [Puppet Users] Refresh Exec resource from a File resource without source =>
Sorry, forgot the doc link: http://docs.puppetlabs.com/references/latest/metaparameter.html#audit On Mon, Jan 14, 2013 at 6:24 PM, Ken Barber <ken@puppetlabs.com> wrote:> You probably want an audit field in your file resource, try this > pattern on for size: > > # cat /tmp/zzz.pp > file {"/tmp/foo": > ensure => file, > notify => Exec["foo"], > audit => ''content'', > } > exec {"foo": > command => "/usr/bin/true", > refreshonly => true, > } > # echo "foobar" > /tmp/foo > # ./bin/puppet apply /tmp/zzz.pp > Notice: /Stage[main]//File[/tmp/foo]/content: audit change: previously > recorded value {md5}2b00042f7481c7b056c4b410d28f33cf has been changed > to {md5}14758f1afd44c09b7992073ccf00b43d > Notice: /Stage[main]//Exec[foo]: Triggered ''refresh'' from 1 events > Notice: Finished catalog run in 0.13 seconds > # ./bin/puppet apply /tmp/zzz.pp > Notice: Finished catalog run in 0.06 seconds > > Otherwise, you could always just notify on the package update. > > On Mon, Jan 14, 2013 at 6:09 PM, Vaidas Jablonskis <jablonskis@gmail.com> wrote: >> Hi Guys, >> >> My manifest code looks pretty much like below: >> >> ------------ >> exec { ''sync-business-logic'': >> path => "/usr/bin:/bin:${bl_path}", >> cwd => $bl_path, >> command => ''sync-bl.pl'', >> refreshonly => true, >> subscribe => File[$sync_bl_files], >> } >> >> file { $sync_bl_files: >> ensure => file, >> require => Package[$dpx::package_name], >> } >> ------------- >> >> As you can see, my File[$sync_bl_files] resource does not have any source, >> because these files are installed by a package. These files change with a >> new version of the package. What I need is to be able to refresh the >> Exec[''sync-business-logic''] resource when $sync_bl_files change. >> >> It does not seem to work if there is no "source =>" specified. >> >> Any ideas? >> >> -- >> 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/-/8HftW4tMIKIJ. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com. >> 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Vaidas Jablonskis
2013-Jan-14 18:38 UTC
Re: [Puppet Users] Refresh Exec resource from a File resource without source =>
That''s incredible. Thanks a lot Ken. It works! On Monday, 14 January 2013 18:25:18 UTC, Ken Barber wrote:> > Sorry, forgot the doc link: > > http://docs.puppetlabs.com/references/latest/metaparameter.html#audit > > On Mon, Jan 14, 2013 at 6:24 PM, Ken Barber <k...@puppetlabs.com<javascript:>> > wrote: > > You probably want an audit field in your file resource, try this > > pattern on for size: > > > > # cat /tmp/zzz.pp > > file {"/tmp/foo": > > ensure => file, > > notify => Exec["foo"], > > audit => ''content'', > > } > > exec {"foo": > > command => "/usr/bin/true", > > refreshonly => true, > > } > > # echo "foobar" > /tmp/foo > > # ./bin/puppet apply /tmp/zzz.pp > > Notice: /Stage[main]//File[/tmp/foo]/content: audit change: previously > > recorded value {md5}2b00042f7481c7b056c4b410d28f33cf has been changed > > to {md5}14758f1afd44c09b7992073ccf00b43d > > Notice: /Stage[main]//Exec[foo]: Triggered ''refresh'' from 1 events > > Notice: Finished catalog run in 0.13 seconds > > # ./bin/puppet apply /tmp/zzz.pp > > Notice: Finished catalog run in 0.06 seconds > > > > Otherwise, you could always just notify on the package update. > > > > On Mon, Jan 14, 2013 at 6:09 PM, Vaidas Jablonskis <jablo...@gmail.com<javascript:>> > wrote: > >> Hi Guys, > >> > >> My manifest code looks pretty much like below: > >> > >> ------------ > >> exec { ''sync-business-logic'': > >> path => "/usr/bin:/bin:${bl_path}", > >> cwd => $bl_path, > >> command => ''sync-bl.pl'', > >> refreshonly => true, > >> subscribe => File[$sync_bl_files], > >> } > >> > >> file { $sync_bl_files: > >> ensure => file, > >> require => Package[$dpx::package_name], > >> } > >> ------------- > >> > >> As you can see, my File[$sync_bl_files] resource does not have any > source, > >> because these files are installed by a package. These files change with > a > >> new version of the package. What I need is to be able to refresh the > >> Exec[''sync-business-logic''] resource when $sync_bl_files change. > >> > >> It does not seem to work if there is no "source =>" specified. > >> > >> Any ideas? > >> > >> -- > >> 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/-/8HftW4tMIKIJ. > >> To post to this group, send email to puppet...@googlegroups.com<javascript:>. > > >> To unsubscribe from this group, send email to > >> puppet-users...@googlegroups.com <javascript:>. > >> 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 view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/sByCaTQb36MJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.