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-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.
>>>>         

-- 

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-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.


Reply via email to