From 779fea867a9e23ad48cd877a88756cc5792e9e0c Mon Sep 17 00:00:00 2001 From: Nigel Kersten Date: Mon, 15 Nov 2010 12:36:34 -0800 Subject: (#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 --- lib/puppet/provider/maillist/mailman.rb | 11 +++++------ 1 file 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 -- cgit