clean up docs for new parser functions
(#20383) Provide location of duplicate resource in error

Commit ac83f85 cleaned up Puppet::Error and extracted file and line
presentation into a mixin. However the DuplicateResourceError exception
was relying on that behavior, and when the behavior was extracted the
location of the duplicate resource was lost.

This commit mixes in the ExternalFileError mixin and passes the file
line and number to the exception so that the duplicate resource location
can be displayed.

Thanks to Richard Clamp <richardc@unixbeard.net> for finding the
original error and providing the base for this fix.
Merge branch '20383-duplicate_resource_error_location' into stable
Merge pull request #1696 from Sharpie/21028-document-future-parser-functions

clean up docs for new parser functions (backport)
(maint) Fix Facter stubs in redhat service spec

The underlying OS was leaking into this test causing issues. This makes sure
operatingsystem is stubbed, and also corrects the casing on stubbed osfamily
values.
Merge branch 'stable'

* stable:
  (maint) Fix Facter stubs in redhat service spec
  (#20383) Provide location of duplicate resource in error
  clean up docs for new parser functions
maint: Refactor mount specs

Reduce the number of describe blocks and use real object instances
instead of mocks. This way it should be easier to extend the specs in
the future
(6409) Reject spaces in mount type

The puppet mount provider is unable to handle fstab entries with spaces
so it should not try to write such entries.

The accepted solution in redmine ticket #6409 is for the mount type to
reject property values that contain spaces.
(#6409) Dont use invalid values in type_spec

The type_spec uses the mount type as an example in a lot of spec tests.
Unfortunately it uses example values that are now invalid for the mount
type.

The atboot property only accepts :yes and :no now, because these are the
only valid options in /etc/vfstab [1].

[1] http://docs.oracle.com/cd/E19455-01/805-7228/6j6q7uev3/index.html
(#4689) Set correct blockdevice for nfs mounts

Solaris vfstab has an extra field "blockdevice". The Puppet
Documentation claims that the blockdevice should default to the correct
value and you do not have to set it explicitly. While this may be true
for regular devices the user has to set blockdevice explicitly if the
mount resource describes an NFS share.

The correct entry for NFS shares in /etc/vfstab is to set blockdevice
to "-"
(#6793) Remove trailing slashes from mount resource

The mount system command always displays mount points without trailing
slashes so if a user defines a mount resource with a trailing slash,
puppet will always see the mount resource as unmounted and as a result
will keep remounting the device on every puppet run.

Munge the name and strip away any trailing slashes but make sure that we
do not remove the slash if the mount describes the root directory `/`.
This way the munged name will always equal the mount output and puppet
is able to find it.
(#21168) Set default pass property to "-" on Solaris

The current default value of "0" for the pass property has a different
meaning on Solaris than on other systems. A value of 0 actually depends
on the filesystem type: It will cause the system to not fsck the device
if it is an UFS filesystems and will fsck the device if it is not an UFS
filesystem

(http://docs.oracle.com/cd/E19455-01/805-6331/fsadm-59727/index.html)

I never actually saw a value of "0" in any /etc/vfstab and it seems to
be common to use "-" instead. This will always deactivate filesystem
checking and is also used in many examples (see link above).

Change the default value of the pass property to "-" on Solaris and keep
the default value of zero on other systems.
(#15837) Do not pass options explicitly when mounting

The mount provider explicitly passes the mountoptions to the mount
command with the "-o" parameter. While this works in most cases it fails
when the option property contains an option that needs to be unique as
the default behaviour of the mount command seems to be to merge fstab
options with explicitly definied options via the commandline.

Since the mountprovider always updates the /etc/fstab file before
attempting to mount we should not need to pass the options explicitly.
The current code mentions some weired behaviour on MacOSX so we keep the
original behaviour on MacOS and drop the explicit options on
all other platforms.

This also fixes #7791
Merge pull request #1699 from stschulte/ticket/master/mount_fixes

Various mount fixes
(maint) Removing unneeded patch from %install in RPM spec

Removing patch rundir-perms.patch from RPM spec as it is no longer needed.
The patch was to dynamically change the rundir mode from 01777 to 0755 for Redhat.
The rundir mode was changed to 0755 in lib/puppet/defaults.rb in commit a05d613751335fd16a222bf2e2300e7ccf41dc8a
Merge pull request #1708 from jjulien/remove_rundir_patch

(maint) Removing unneeded patch from %install in RPM spec
(#21023) Flush caches on preferred_run_mode change

`Setting.preferred_run_mode` affects a lot of settings values -- such as the
modulepath that gets used for environments. Prior to f4e229e the `run_mode` was
an actual setting rather than an attribute of the settings class. This meant
that changing the value of the `run_mode` would trigger a cache flush on
Settings objects so that things like `modulepath` would be updated.

This patch:

  - Moves cache flushing out of the `Settings.set_value` method and into a new
    method `flush_cache`.

  - Adds tests to ensure that `flush_cache` is called by both `set_value` and
    `preferred_run_mode=`.