Re: [Puppet Users] property file provider

2011-08-23 Thread Stefan Schulte
On Tue, Aug 23, 2011 at 05:47:07PM -0400, David Kavanagh wrote: > yes, That's actually does. I wasn't finding much to read about this. > > David Maybe http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UN -Stefan pgppZP1OBsrlU.pgp Description: PGP signature

Re: [Puppet Users] property file provider

2011-08-23 Thread David Kavanagh
yes, That's actually does. I wasn't finding much to read about this. David On Tue, Aug 23, 2011 at 5:12 PM, Stefan Schulte wrote: > On Tue, Aug 23, 2011 at 04:27:30PM -0400, David Kavanagh wrote: >> I understand regular expressions. been doing them a long time in >> various languages. But, how a

Re: [Puppet Users] property file provider

2011-08-23 Thread Stefan Schulte
On Tue, Aug 23, 2011 at 04:27:30PM -0400, David Kavanagh wrote: > I understand regular expressions. been doing them a long time in > various languages. But, how are the fields determined from this regex? > > David > You have to put everything you want to capture in parentheses, so /^Hello (.*

Re: [Puppet Users] property file provider

2011-08-23 Thread David Kavanagh
Like a charm! What designates the fields in the regex? I'm having trouble finding documentation on that part. David On Tue, Aug 23, 2011 at 4:59 PM, Stefan Schulte wrote: > On Tue, Aug 23, 2011 at 04:19:40PM -0400, David Kavanagh wrote: >> for reference, here's how the regex matches the trailing

Re: [Puppet Users] property file provider

2011-08-23 Thread Stefan Schulte
On Tue, Aug 23, 2011 at 04:19:40PM -0400, David Kavanagh wrote: > for reference, here's how the regex matches the trailing comment; > http://rubular.com/r/vJUtBWpB6J > Yes, rubular shows all fields but the last field is in fact nil and not an empty string. Try to replace str += " # #{hash[:com

Re: [Puppet Users] property file provider

2011-08-23 Thread David Kavanagh
I understand regular expressions. been doing them a long time in various languages. But, how are the fields determined from this regex? David On Tue, Aug 23, 2011 at 4:19 PM, David Kavanagh wrote: > for reference, here's how the regex matches the trailing comment; > http://rubular.com/r/vJUtBWpB

Re: [Puppet Users] property file provider

2011-08-23 Thread David Kavanagh
for reference, here's how the regex matches the trailing comment; http://rubular.com/r/vJUtBWpB6J On Tue, Aug 23, 2011 at 4:17 PM, David Kavanagh wrote: > Hi Stefan, > I have it working using your suggestions (I took out my hacks). I > adjusted the match regex to match the quotes in the value po

Re: [Puppet Users] property file provider

2011-08-23 Thread David Kavanagh
Hi Stefan, I have it working using your suggestions (I took out my hacks). I adjusted the match regex to match the quotes in the value portion. Otherwise, I kept getting more quotes added in each time the file was processed. The only glitch now is that it always thinks there's a comment, so even if

Re: [Puppet Users] property file provider

2011-08-23 Thread Stefan Schulte
On Tue, Aug 23, 2011 at 10:32:54AM -0400, David Kavanagh wrote: > I did get this working. In a nutshell, I modified to_line like this; > def self.to_line(hash) > return super unless hash[:record_type] == :parsed > "#{hash[:name]}=#{hash[:value]}" > end As I said, I wouldn't to that. Ju

Re: [Puppet Users] property file provider

2011-08-23 Thread David Kavanagh
I did get this working. In a nutshell, I modified to_line like this; def self.to_line(hash) return super unless hash[:record_type] == :parsed "#{hash[:name]}=#{hash[:value]}" end which handles the other line types. To handle wrapping values in quotes, I changed the type like this; ne

Re: [Puppet Users] property file provider

2011-08-22 Thread David Kavanagh
Thanks, I'll try to work through your suggestions. I took this from the nova_config stuff on github, so that was my example. David On Mon, Aug 22, 2011 at 7:36 PM, Stefan Schulte wrote: > On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: >> I'm working on a type/provider for the eu

Re: [Puppet Users] property file provider

2011-08-22 Thread Stefan Schulte
On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: > I'm working on a type/provider for the eucalyptus.conf file. What I > have generally works for modifying properties. I have a couple of > issues and not being very experienced with Ruby and custom providers, > I wonder if anyone can

[Puppet Users] property file provider

2011-08-22 Thread David Kavanagh
I'm working on a type/provider for the eucalyptus.conf file. What I have generally works for modifying properties. I have a couple of issues and not being very experienced with Ruby and custom providers, I wonder if anyone can help? The code is included below. The key/value constructs in the file l