You could simply dump xml output inside your template.

e.g. if you have a simple ruby hash a[:b]="c"
in your template do:
<%=a.to_xml%> and you will get the following output:

=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<hash>\n
<b>c</b>\n</hash>\n"

cheers,
Ohad


On Wed, May 27, 2009 at 8:13 AM, Joel Heenan <[email protected]> wrote:

> Greg,
>
> What I struggled with with a template is that the data is
> multi-dimensional. So for instance I did:
>
> $policyengines = [ "PolicyEngine01/10.4.4.1", "PolicyEngine02/10.4.4.2" ]
>
> Then in the template I could $policyengine.split("/")[0] to pull out
> various aspects. And this works, but its ugly as all hell and is very
> inflexible.
>
> Can you take exported resources, put them into an array, then feed them
> into a template and access them as fully blown objects? That would solve my
> problem I think.
>
> Joel
>
>
> On Wed, May 27, 2009 at 10:07 AM, Greg <[email protected]> wrote:
>
>>
>> Joel,
>>
>> Would a template be more what you are looking for? I've only done
>> a couple of very simple templates myself, but it sounds like the sort
>> of thing that it would be suited to - provided you can get the
>> required
>> info to the .erb file...
>>
>> Greg
>>
>> On May 27, 9:24 am, Joel Heenan <[email protected]> wrote:
>> > I have an XML file which contains a list of services for a piece of
>> > middleware, where a service is a tuple: ServiceType, IP Address, Port
>> > number.
>> >
>> > I would like to generate this file automatically for each node whenever
>> I
>> > add a new service into puppet. I think external resources are the way to
>> go
>> > about this but I'm not sure how to proceed from there:
>> >
>> > Do I need to code up my own Puppet Type, I guess something like the
>> sshkey
>> > type, and have it output the XML file? Or can I concatenate files
>> similar to
>> > David Schmitt's technique in his modules-common?
>> >
>> > Joel
>>
>>
>
> >
>

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