Sha256: 1042a06eb5413fc2ed7652f60b3eb19787866625389393da2880b142f6045864

Contents?: true

Size: 1.5 KB

Versions: 164

Compression:

Stored size: 1.5 KB

Contents

module Puppet
  Type.newtype(:maillist) do
    @doc = "Manage email lists.  This resource type can only create
      and remove lists; it cannot currently reconfigure them."

    ensurable do
      defaultvalues

      newvalue(:purged) do
        provider.purge
      end

      def change_to_s(current_value, newvalue)
        return "Purged #{resource}" if newvalue == :purged
        super
      end

      def insync?(is)
        return true if is == :absent && should == :purged
        super
      end
    end

    newparam(:name, :namevar => true) do
      desc "The name of the email list."
    end

    newparam(:description) do
      desc "The description of the mailing list."
    end

    newparam(:password) do
      desc "The admin password."
    end

    newparam(:webserver) do
      desc "The name of the host providing web archives and the administrative interface."
    end

    newparam(:mailserver) do
      desc "The name of the host handling email for the list."
    end

    newparam(:admin) do
      desc "The email address of the administrator."
    end

    def generate
      if provider.respond_to?(:aliases)
        should = self.should(:ensure) || :present
        if should == :purged
          should = :absent
        end
        atype = Puppet::Type.type(:mailalias)

        provider.aliases.
          reject  { |name,recipient| catalog.resource(:mailalias, name) }.
          collect { |name,recipient| atype.new(:name => name, :recipient => recipient, :ensure => should) }
      end
    end
  end
end

Version data entries

164 entries across 164 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/type/maillist.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/type/maillist.rb
puppet-4.10.12 lib/puppet/type/maillist.rb
puppet-4.10.12-x86-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.12-x64-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.12-universal-darwin lib/puppet/type/maillist.rb
puppet-4.10.11 lib/puppet/type/maillist.rb
puppet-4.10.11-x86-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.11-x64-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.11-universal-darwin lib/puppet/type/maillist.rb
puppet-4.10.10 lib/puppet/type/maillist.rb
puppet-4.10.10-x86-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.10-x64-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.10-universal-darwin lib/puppet/type/maillist.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/type/maillist.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/type/maillist.rb
puppet-4.10.9 lib/puppet/type/maillist.rb
puppet-4.10.9-x86-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.9-x64-mingw32 lib/puppet/type/maillist.rb
puppet-4.10.9-universal-darwin lib/puppet/type/maillist.rb