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; } 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-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.
On Wed, Jan 13, 2010 at 1:24 PM, JoE <joehillen@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-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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.
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-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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.
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-users@googlegroups.com. > > > To unsubscribe from this group, send email to > > > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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.
Trevor Hemsley
2010-Jan-14 15:33 UTC
Re: [Puppet Users] Re: Run a script when it has been changed.
You''re missing things from there. You have a file{} resource for the directory /usr/bin/data but no definition for the get-data.sh within it. The file itself needs to be managed by puppet before you can subscribe to it. Add a file {"/usr/bin/data/get-data.sh"} definition. JoE 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-users@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/puppet-users?hl=en. >>>>-- Trevor Hemsley Infrastructure Engineer ................................................. * C A L Y P S O * 4th Floor, Tower Point, 44 North Road, Brighton, BN1 1YR, UK OFFICE +44 (0) 1273 666 350 FAX +44 (0) 1273 666 351 ................................................. www.calypso.com This electronic-mail might contain confidential information intended only for the use by the entity named. If the reader of this message is not the intended recipient, the reader is hereby notified that any dissemination, distribution or copying is strictly prohibited. * P * /*/ Please consider the environment before printing this e-mail /*/ -- 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.
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-users@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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.
>You''re missing things from there. You have a file{} resource for the >directory /usr/bin/data but no definition for the get-data.sh within it. >The file itself needs to be managed by puppet before you can subscribe >to it. Add a file {"/usr/bin/data/get-data.sh"} definition.I should have refreshed the discussion before sending... On Jan 14, 10:38 am, JoE <joehil...@gmail.com> wrote:> 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-users@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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.