summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNigel Kersten <nigel@puppetlabs.com>2010-11-15 12:36:34 -0800
committerMarkus Roberts <Markus@reality.com>2010-11-30 13:37:37 -0800
commit779fea867a9e23ad48cd877a88756cc5792e9e0c (patch)
treeeebdbd92847d768532b7de0819908170ef5e2dd4
parent83f878e2304595f803e105abb9b5e77d7ce3272a (diff)
downloadpuppet-779fea867a9e23ad48cd877a88756cc5792e9e0c.tar.gz
puppet-779fea867a9e23ad48cd877a88756cc5792e9e0c.tar.xz
puppet-779fea867a9e23ad48cd877a88756cc5792e9e0c.zip
(#5304) Use internal_name rather than real_name for maillist provider
We've switched to using list_lists --bare which shows the internal_name rather than "real_name", which is the authoritative identifier. Doing this also means we have less output to scrub, so the code is simpler. Signed-off-by: Nigel Kersten <nigel@puppetlabs.com>
-rwxr-xr-xlib/puppet/provider/maillist/mailman.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/puppet/provider/maillist/mailman.rb b/lib/puppet/provider/maillist/mailman.rb
index 4fdc20a69..633642af7 100755
--- a/lib/puppet/provider/maillist/mailman.rb
+++ b/lib/puppet/provider/maillist/mailman.rb
@@ -2,11 +2,11 @@ require 'puppet/provider/parsedfile'
Puppet::Type.type(:maillist).provide(:mailman) do
if [ "CentOS", "RedHat", "Fedora" ].any? { |os| Facter.value(:operatingsystem) == os }
- commands :list_lists => "/usr/lib/mailman/bin/list_lists", :rmlist => "/usr/lib/mailman/bin/rmlist", :newlist => "/usr/lib/mailman/bin/newlist"
+ commands :list_lists => "/usr/lib/mailman/bin/list_lists --bare", :rmlist => "/usr/lib/mailman/bin/rmlist", :newlist => "/usr/lib/mailman/bin/newlist"
commands :mailman => "/usr/lib/mailman/mail/mailman"
else
# This probably won't work for non-Debian installs, but this path is sure not to be in the PATH.
- commands :list_lists => "list_lists", :rmlist => "rmlist", :newlist => "newlist"
+ commands :list_lists => "list_lists --bare", :rmlist => "rmlist", :newlist => "newlist"
commands :mailman => "/var/lib/mailman/mail/mailman"
end
@@ -14,10 +14,9 @@ Puppet::Type.type(:maillist).provide(:mailman) do
# Return a list of existing mailman instances.
def self.instances
- list_lists.split("\n").reject { |line| line.include?("matching mailing lists") }.collect do |line|
- name, description = line.sub(/^\s+/, '').sub(/\s+$/, '').split(/\s+-\s+/)
- description = :absent if description.include?("no description available")
- new(:ensure => :present, :name => name, :description => description)
+ list_lists.split("\n").collect do |line|
+ name = line.strip
+ new(:ensure => :present, :name => name)
end
end