Sha256: 590747b1cdca01d691c58c7266651feaa57a390534133bf30214a591ee0b9ad4

Contents?: true

Size: 1.5 KB

Versions: 164

Compression:

Stored size: 1.5 KB

Contents

module Puppet
  Type.newtype(:mailalias) do
    @doc = "Creates an email alias in the local alias database."

    ensurable

    newparam(:name, :namevar => true) do
      desc "The alias name."
    end

    newproperty(:recipient, :array_matching => :all) do
      desc "Where email should be sent.  Multiple values
        should be specified as an array.  The file and the
        recipient entries are mutually exclusive."

      def is_to_s(value)
        if value.include?(:absent)
          super
        else
          value.join(",")
        end
      end

      def should_to_s(value)
        if value.include?(:absent)
          super
        else
          value.join(",")
        end
      end
    end

    newproperty(:file) do
      desc "A file containing the alias's contents.  The file and the
        recipient entries are mutually exclusive."

      validate do |value|
	unless Puppet::Util.absolute_path?(value)
	  fail Puppet::Error, "File paths must be fully qualified, not '#{value}'"
	end
      end
    end

    newproperty(:target) do
      desc "The file in which to store the aliases.  Only used by
        those providers that write to disk."

      defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
          @resource.class.defaultprovider.default_target
        else
          nil
        end
      }
    end

    validate do
      if self[:recipient] && self[:file]
	self.fail "You cannot specify both a recipient and a file"
      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/mailalias.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/type/mailalias.rb
puppet-4.10.12 lib/puppet/type/mailalias.rb
puppet-4.10.12-x86-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.12-x64-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.12-universal-darwin lib/puppet/type/mailalias.rb
puppet-4.10.11 lib/puppet/type/mailalias.rb
puppet-4.10.11-x86-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.11-x64-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.11-universal-darwin lib/puppet/type/mailalias.rb
puppet-4.10.10 lib/puppet/type/mailalias.rb
puppet-4.10.10-x86-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.10-x64-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.10-universal-darwin lib/puppet/type/mailalias.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/type/mailalias.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/type/mailalias.rb
puppet-4.10.9 lib/puppet/type/mailalias.rb
puppet-4.10.9-x86-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.9-x64-mingw32 lib/puppet/type/mailalias.rb
puppet-4.10.9-universal-darwin lib/puppet/type/mailalias.rb