Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-20 Thread Ganesh Nalawade
Great, It worked for me. Thanks Dylan, Reid and Michael. Appreciate all your help. Regards, Ganesh On Sat, Jun 20, 2015 at 2:21 PM, Dylan Ratcliffe dylan.ratcli...@puppetlabs.com wrote: I would use the value of the $title variable to ensure both that you can refer to the new_type resource

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-20 Thread Dylan Ratcliffe
I would use the value of the $title variable to ensure both that you can refer to the new_type resource and that it will have a unique title each time the defined type is called, to find out more check out this page, it has everything you need to know about writing a defined type:

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-20 Thread ganesh634
Is there a way to retrieve the parameter values of resource for previous client run during current execution of client. The reason for this question is how to handle scenario where path value of 'new_type' resource is changed to already existing file whose contents are not changed. In

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-19 Thread Ganesh Nalawade
Thanks Dylan. This approach looks good as and users don't have to add file resource explicitly. define new_type::something ( $file_path, ) { file { $file_path: ensure = file, notify= New_type['another_resource'], ---*'another_resource' must be a variable as it is title of

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-19 Thread Dylan Ratcliffe
That's close, You don't need to set ensure on a defined type unless you have exposed that as a paremeter, and you do need to set ensure for that file. Going back to the original issue of accessing the parameter of one resource from another, i'll give a little example of how I envision it:

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-17 Thread ganesh634
Thanks Michael!!! new_type resource need to read content of 'interface' file and perform some action. Overloading the notify/require relationship to make that association would be a bad idea - they're 1-to-many and many-to-1 relationships - and probably complicated to make work. Sorry i am

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-17 Thread Reid Vandewiele
What Michael said about the design is worth considering. If it makes sense to reference another resource instead of a path string (e.g. File[myfile]) and you're just curious about how to do it, there's code that does similar things in the puppetlabs/transition module, as well as in changes

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-17 Thread Dylan Ratcliffe
Assuming that the file and the new_type resource will always be together I would wrap them in a defined type and expose everything you need as parameters. That way both can have access to it without any hacky stuff. I'm not sure of your level of Puppet knowledge so if that makes no sense let

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-17 Thread Ganesh Nalawade
@Reid: Agreed it make sense to reference another resource instead of path string. The links you shared are very helpful. Thanks!!! @Dylan: While going through defined types i came across vhost here: https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/vhost.pp I am not very

[Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-17 Thread ganesh634
Pasted below an example relation for new resource say 'new_type'. file { interface: path= /var/tmp/test.txt, content = template(module/test_template.erb), notify = new_type['sample'], } new_type

Re: [Puppet-dev] Accessing attribute value of one resource in another resource impleataion

2015-06-17 Thread Michael Smith
There's probably a way to do that, but I don't think it's a good idea. In order to look at the 'path' attribute of the 'file' resource, you'd need to specify which 'file' resource your new_type relates to. That means new_type would have a property with the value File['interface'], which isn't