On Wed, Mar 28, 2012 at 8:42 AM, Michael K <[email protected]> wrote:
> Hello Derek,
>
> Thanks for the quick reply. I've been thinking along those lines as well,
> create a md5 sum or something of both the file and my newly created content
> string. Problem is: is this the correct way to do it? I've found multiple
> type & provider examples on github which DO NOT do this. Are they all
> inherently broken? Could someone confirm or deny this?

I'm not familiar with the format of this file, so I'm not sure why
custom provider is preferable over a native file type in puppet or
concat file using templates.

self.exists? is correct. In this case you are just checking if the
file exists to determine whether to invoke create/destroy method. If
you ensure=>present and the file does not exist it will invoke create,
and if you ensure=>absent, and the file exist it will invoke destroy.
The reason the content of the file is not managed is because dbnames
is a parameter and not a property. If you want to manage the content
of the file you need specify dbnames as a property and implement def
dbnames in the provider to retrieve the file content for comparison
and def dbnames=(value) to update the content of the file if it no
longer matches your desired content value.

See Brice blog for more in depth explanation:
http://www.masterzen.fr/2011/11/02/puppet-extension-point-part-2/

Thanks,

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to