The default processing uses split() to break the line into records on the separator, which breaks if records can contain the separator.
This commit fixes #1560 Signed-off-by: Paul Lathrop <[email protected]> --- lib/puppet/provider/mailalias/aliases.rb | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/lib/puppet/provider/mailalias/aliases.rb b/lib/puppet/provider/mailalias/aliases.rb index 8b5c456..fa3ef9f 100755 --- a/lib/puppet/provider/mailalias/aliases.rb +++ b/lib/puppet/provider/mailalias/aliases.rb @@ -10,13 +10,24 @@ Puppet::Type.type(:mailalias).provide(:aliases, record_line :aliases, :fields => %w{name recipient}, :separator => /\s*:\s*/, :block_eval => :instance do def post_parse(record) - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] # It's not sufficient to assign to an existing hash. recipient = record[:recipient].split(/\s*,\s*/).collect { |d| d.gsub(/^['"]|['"]$/, '') } record[:recipient] = recipient record end + def process(line) + ret = {} + # Everything up to the first ':' character is the first + # record (:name). + ret[:name] = line[/^[^\s:]*/] + # Everything after the first ':' character (except leading + # and trailing whitespace) is the second record (:recipient). + ret[:recipient] = line[(line.index(/\s*:\s*/) + 1)..line.length].lstrip.rstrip + ret + end + def to_line(record) dest = record[:recipient].collect do |d| # Quote aliases that have non-alpha chars -- 1.6.1 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" 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-dev?hl=en -~----------~----~----~----~------~----~------~--~---
