Sha256: 79e0f221c5223954e9d4db7f3b64636119a131ffdbc699825446c63b73d5de26
Contents?: true
Size: 933 Bytes
Versions: 4
Compression:
Stored size: 933 Bytes
Contents
require 'puppet/provider/parsedfile' Puppet::Type.type(:mailalias).provide(:aliases, :parent => Puppet::Provider::ParsedFile, :default_target => "/etc/aliases", :filetype => :flat ) do text_line :comment, :match => /^#/ text_line :blank, :match => /^\s*$/ record_line :aliases, :fields => %w{name recipient}, :separator => /\s*:\s*/, :block_eval => :instance do def post_parse(record) record[:recipient] = record[:recipient].split(/\s*,\s*/).collect { |d| d.gsub(/^['"]|['"]$/, '') } record end def to_line(record) dest = record[:recipient].collect do |d| # Quote aliases that have non-alpha chars if d =~ /[^-\w@.]/ '"%s"' % d else d end end.join(",") return "%s: %s" % [record[:name], dest] end end end
Version data entries
4 entries across 4 versions & 1 rubygems