Re: [Puppet Users] Parsing key/value pairs in ruby

2010-08-12 Thread Patrick Mohr
On Aug 12, 2010, at 10:55 AM, Rein Henrichs wrote: > Excerpts from Paul Nasrat's message of Thu Aug 12 06:45:52 -0700 2010: >> You might use shellwords to handle the quoting. >> require 'shellwords' l = %q(printer-make-and-model='Brother HL-2060 Foomatic/hpijs-pcl5e (recommended)

Re: [Puppet Users] Parsing key/value pairs in ruby

2010-08-12 Thread Rein Henrichs
Excerpts from Paul Nasrat's message of Thu Aug 12 06:45:52 -0700 2010: > You might use shellwords to handle the quoting. > > >> require 'shellwords' > >> l = %q(printer-make-and-model='Brother HL-2060 Foomatic/hpijs-pcl5e > >> (recommended)' printer-state=3 printer-state-change-time=1266621145 >

Re: [Puppet Users] Parsing key/value pairs in ruby

2010-08-12 Thread Paul Nasrat
On 12 August 2010 05:33, Patrick Mohr 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=12

Re: [Puppet Users] Parsing key/value pairs in ruby

2010-08-11 Thread John Warburton
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

[Puppet Users] Parsing key/value pairs in ruby

2010-08-11 Thread Patrick Mohr
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=85647