On Saturday, March 14, 2015 at 11:22:21 PM UTC+13, Krzysztof Suszyński 
wrote:
>
> You have declared a property ip. This means that it will be ensurable as 
> well and you should declare setter and getter for it:
>
> def ip=(newip)
>   # Mayby like this
>   host       = resource[:name]
>   postdata   = {
>     'addr'      => newip,
>     'hostnames' => [ host ]
>   }
>   RestClient.put("#{baseurl}#{host_uri}", postdata.to_json, header)
>   RestClient.get("#{baseurl}#{deploy_uri}", header)
> end
>
> def ip
>   # Mayby like this
>   result = RestClient.get("#{baseurl}#{deploy_uri}", header)
>   result.ip
> end
>
> Getters will be executed if type exists. Setters will be executed if 
> resource[:ip] value differ from one returned from your getter.
>
> I recommend you read the book "Puppet Types and Providers" by Dan Bode. 
> Buy or search web for ebook.
>

Thank you. I ended up making it a param for now. :)  

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c9e2345e-2920-46e3-8112-2514a3ef10d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to