Nevermind, I solved the problem. The file needs to be explicitly mentioned even though it is already in /usr/bin/data, see the code below:
define get-data() { file { "/usr/bin/data": owner => "root", group => "wheel", mode => "755", purge => true, recurse => true, source => "puppet://puppet/data/bin/"; } file { "/usr/bin/data/get-data.sh": owner => "root", group => "wheel", mode => "755", source => "puppet://puppet/data/bin/get-data.sh"; } exec { "/usr/bin/data/get-data.sh restart": subscribe => File["/usr/bin/data/get-data.sh"], refreshonly => true; } } Now, everything works as it should and the script only runs when it is supposed to. Thanks for the help. On Jan 14, 9:59 am, JoE <joehil...@gmail.com> wrote: > What is interesting is that this will not work even if "get-data.sh" > is already in "/usr/bin/data". Is this a bug? > > On Jan 14, 9:57 am, JoE <joehil...@gmail.com> wrote: > > > Yeah, that is what is actually in my file. I had to change the names > > to protect the innocent, and I made some mistakes while doing that. > > Here is a more accurate look at what I am working on: > > > class data { > > > } > > > define get-data() { > > > file { "/usr/bin/data": > > ensure => directory, > > owner => "root", > > group => "wheel", > > mode => "755", > > purge => true, > > recurse => true, > > source => "puppet://puppet/data/bin/"; > > } > > > exec { "/usr/bin/data/get-data.sh restart": > > subscribe => File["/usr/bin/data/get-data.sh"], > > refreshonly => true; > > } > > > } > > > I also copied the wrong error message. (I really shouldn't write > > emails at the end of the day. =P ) > > > warning: Not using cache on failed catalog > > warning: Configuration could not be instantiated: Could not find > > dependency File[/usr/bin/data/get-data.sh] for Exec[/usr/bin/data/get- > > data.sh restart] at /usr/local/etc/puppet/modules/data/manifests/ > > init.pp:238 > > > So, yeah, that doesn't work. > > > I tried subscribing to the directory and it does work. Though, I don't > > necessarily want to subscribe to the directory if I can avoid it > > because some other files in there may change and I might not want to > > restart the script then. > > > Sorry for the confusion earlier. > > > On Jan 13, 5:35 pm, Dan Bode <d...@reductivelabs.com> wrote: > > > > On Wed, Jan 13, 2010 at 1:24 PM, JoE <joehil...@gmail.com> wrote: > > > > Hi all, > > > > > Currently I am trying to have a script run whenever a change is made > > > > to it. Here is an example of when my configurations look like: > > > > > file { "/usr/bin/data/": > > > > owner => "rot", > > > > group => "wheel", > > > > mode => "755", > > > > purge => true, > > > > recurse => true, > > > > source => "puppet://puppet/data/bin/"; > > > > } > > > > > exec { "/usr/bin/data/get-data.sh restart": > > > > subscribe => "/usr/bin/data/get-data.sh", > > > > refreshonly => true; > > > > } > > > > try with a resource reference. > > > > the syntax is: > > > > File['/usr/bin/data/get-data.sh'] > > > > I am not 100% sure this will work, you may have to subscribe to the dir > > > (let > > > me know :) > > > > > The script is contained in /usr/bin/data/ which is managed by Puppet. > > > > But when I try to run this I get the following error: > > > > > err: Could not create /usr/bin/data/get_data.sh restart: Parameter > > > > subscribe failed: Relationships must be resource references at /usr/ > > > > local/etc/puppet/modules/data/manifests/init.pp:237 > > > > warning: Not using cache on failed catalog > > > > warning: Configuration could not be instantiated: Parameter subscribe > > > > failed: Relationships must be resource references at /usr/local/etc/ > > > > puppet/modules/data/manifests/init.pp:23 > > > > > Is there a way to have a script subscribe to itself? > > > > > Thank you for you help. > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups > > > > "Puppet Users" group. > > > > To post to this group, send email to puppet-us...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@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-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.