Ohad,

Thanks for that, that is quite interesting. Unfortunately AFAIK I can't
define the hashes in puppet so this is leading to a kinda - read the YAML,
parse it, output XML file kinda solution I think which is probably what I
was trying to avoid if only because it doesn't seem like the "puppet way".

Cheers

Joel

On Wed, May 27, 2009 at 10:41 AM, Ohad Levy <ohadl...@gmail.com> wrote:

> 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 <jo...@planetjoel.com> 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 <greg.b...@gmail.com> 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 <jo...@planetjoel.com> 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 puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to