On Fri, Aug 22, 2008 at 10:55 AM, Francois Deppierraz
<[EMAIL PROTECTED]> wrote:
> Yes, I'm trying to eval puppet code.
>
> In fact this eval function is only part of another function I'm trying
> to hack.
>
> The goal is to generate ressources in Puppet from a REST webservice
> returning CSV data.
Have you seen Export/Collect and Virtual Resources?
> For example, imagine you have a webservice like that listing all your users:
>
> uid;gecos;password
> francois;Francois Deppierraz;1234
> john;John Doe;5678
>
> Based on that, I want to generate the following ressource *dynamically*.
>
> user {"francois":
> ensure => present,
> gecos => "Francois Deppierraz",
> password => "1234",
> }
>
> user {"john":
> ensure => present,
> gecos => "John Doe",
> password => "5678",
> }
>
> The current usage of this function is:
>
> class blah {
> csv_template "http://mydb/users" "my-user-template.erb"
> }
I don't think there is an easy way to do what you are looking for -
perhaps Luke or Andrew can shed some light on how you might go about
doing that.
My gut tells me that you would need your eval function to somehow call
the parser on your snippet, then insert the resulting resources into
the graph... but I have no idea where you would begin to do that.
I know some tricks like this have been played by inserting resources
directly into the database and doing an export/collect like
operation..
Adam
--
HJK Solutions - We Launch Startups - http://www.hjksolutions.com
Adam Jacob, Senior Partner
T: (206) 508-4759 E: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---