I based my bad first ruby code on
http://www.devco.net/archives/2008/04/17/easy_per-machine_custom_facts_
for_puppet.php

I just checked the URL, and Volcane admits the code was bad too - so have a
look at
http://www.devco.net/archives/2008/06/16/rework_of_puppet_facts_for_etcfactstxt.php

John

On 12 August 2010 14:33, Patrick Mohr <[email protected]> wrote:

> I'm making a provider for cups and I need to parse a string into arbitrary
> key/value pairs.  The string looks like this:
>
> printer-make-and-model='Brother HL-2060 Foomatic/hpijs-pcl5e (recommended)'
> printer-state=3 printer-state-change-time=1266621145
> printer-state-reasons=none printer-type=8564756
>
> I know almost no ruby.  Any advice for what functions or data structures I
> want to use?  It looks like "split" might be what I want to use for parsing,
> but the quoted strings will give me trouble.  For the first version, I'm
> only using 3 of the values.  Do I just want to pull out those manually
> instead of parsing the whole string?
>
> --
> 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]<puppet-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>


-- 
John Warburton
Ph: 0417 299 600
Email: [email protected]

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