source function library *before* client sysconfig overrides

My client's environment mandates strict umask settings:
  - 027 for init scripts
  - 077 for normal users
This causes problems when using exec resources or any add-on functions
that exec external scripts/programs.

The fix is relatively simple - run umask in /etc/sysconfig/puppet
and set a more lenient umask for puppet.
However, the /etc/sysconfig/puppet is sourced before the init
function library so any umask changes made in the former are
overridden by any in the latter.

Looking in other init scripts (including the puppetmaster init
script), it is usual for the function library to be sourced at the
start of the init script, ie. before the sysconfig override.

This change simply moves the lines that source the init function
library to the start of the init script.
(maint) Simplify the CA use of the autosign setting

Commit bca628dc adds proper conversion of autosign input values to
booleans, but Puppet::SSL::CertificateAuthority was still trying to
handle string values. This commit simplifies the checking logic and lets
the autosign setting handle data normalization.
(PUP-1174) enable the purging of authorized ssh keys

Purging authorized ssh keys is difficult because there is no way know
where key files may be located. Users commented that for most it should
be sufficient to clean the keys from users that puppet manages.
John Bollinger suggested a design that's based on a new parameter to the
user type. There are two ways to use it:

user { "name": purge_ssh_keys => true }

to make puppet purge from the default ~/.ssh/authorized_keys file, or

user { "name": purge_ssh_keys => [ "/etc/keyfiles/name" ] }

to specify one or more files in non-standard locations.

The implementation is similar to the file type's purging code. The user
type now has an eval_trace method that searches the specified files for keys
and adds any unmanaged keys to the catalog with ensure => absent.
(PUP-1174) amend resources type documentation

Add a reference to the new purging feature to the documentation of the
resources type description.
(PUP-1174) add tests for the purge_ssh_keys parameter of the user type
Clarified `pattern` parameter for Service type (DOCUMENT-1)
Clarified the use of slashes around RegEx for `pattern` attribute
(PUP-1749) Fix module_tool extract for non-gnu tar

This commit refactors how tar is called when the module tool extracts a
downloaded archive so that it is compatible with generic Unix tar, and
does not require GNU extensions. The commit allows the module tool to
work out of the box on Solaris 10, without requiring access to the gtar
command, and presumably this aspect of the module tool will now work
with tar on other old-style unix platforms as well.
Add tests for module_tool changes

I'm not entirely sure if I'm using #yields() correctly but this allows
me to expect that Dir.chdir is called, and still expect all the calls to
Puppet::Util::Execution.execute to be made.
(PUP-1041) nagios: parse empty parameter values in definitions

This is a valid nagios defintion:

define host {
	parents
	use       linux-server
}

That's because an empty parents list has distinct semantics. There may be
other variables that can take an empty value, possibly in conjunction with
object inheritance.

The naginator provider will not accept this definition, because the
nagios config parser expects a value for each and every parameter.

Fix this by adding an according rule to the grammar.

Also, the lexer must be altered, because parameters and values are lexed
differently and returned as distinct tokens. When encountering newline
while scanning for a parameter value, the lexer must give up and reset
its internal state. (Otherwise, it would not accept another parameter
name or the end of the current definition block.)
(PUP-1585) cron: fix resource duplication in crontab provider

The regression fix for #19876 caused yet another regression in cron
resources that manage the target property, but not the user property.
The earlier fix made sure that a cron resource would not try and manage
a matching record from another user's crontab. It did so by comparing
the record's target to the resource's user property.

When the user is unmanaged, but the target is specified instead, this
would cause puppet to ignore the record on disk and add it once more.

This is fixed by comparing the record's target to either the user
property or the target property. If there is a should-value for the
user, it is used, otherwise the provider falls back to the target
should-value.
(PUP-1585) amend unit test to match corrected behavior

Just a simple addition to the mock object used for some tests, because
the crontab provider will now perform an additional property value lookup
to find an on-disk resource.
(PUP-1624) cron: move the default value logic from user to target

Crontab is an oddball example for parsedfile resources, because resources don't
end up in actual files, but I/O is indirected through crontab(1) instead.
Therefor, the target property doesn't really apply and maps to the user
property instead, after a fashion - the user that runs the cron task is
determined by which crontab the entry is stored in.

For default values, it was determined that the user property should be
processed before the target property (on type level) and choose the default
(i.e. the user running puppet). The target property would use the value
of user as its default.

This leads to a peculiar situation when target is managed but user is not.
User *will* use its default value then, which will often differ from the
choice made for target. Puppet will then try and bring the user property
in sync with the default value.

To evade this, a default value for the user property should be avoided,
at least for resources that use the crontab provider. The current rules:

1. The 'user' property uses the user running puppet as default.
2. When crontab is in use, 'target' uses the 'user' value as default.
3. For other parsedfile providers, 'target' uses the provider's default.

Instead, apply the following rules:

1. When crontab is in use, 'user' has no default value.
2. Otherwise, the default is the user running puppet.
3. If crontab is in use and there is a 'user' value, 'target' defaults to that.
4. If crontab is in use and there is no 'user' value, 'target' defaults to the
user running puppet.
5. For other parsedfile providers, 'target' uses the provider's default.
(PUP-1624) cron: fix a unit test regression

The cron unit tests make use of an artificial trivial provider.
Therefor the type code should not traverse code paths that apply only
when the crontab provider is used. For some reason, this didn't work
correctly when the provider was stubbed in place 'before :all' instead of
'before :each'.

As a result, this following test failed because of the change to the
behavior of the user property when using crontab:

Puppet::Type::Cron should default to user => root
  if Etc.getpwuid(Process.uid) returns nil (#12357)

Restructure the hooks to make the behavioral check pass again.
Remove now-redundant Tar::Solaris from module_tool

Changes to the way Puppet::ModuleTool::Tar::Gnu works means that the
*::Tar::Solaris variant should now be redundant. It existed to require
gtar when the underlying platform did not support GNU-tar options, but
the changes to the core Tar::Gnu class mean that we no longer use any
flags or options that don't work just fine with oldschool unix tar
executables. Remove Puppet::ModuleTool::Tar::Solaris.

On a side note, Tar::Gnu should probably be renamed to something more
generic.
Merge remote-tracking branch 'upstream/master' into stable

Prepare for 3.5.0-rc1

* upstream/master: (800 commits)
  (PUP-1085) Add and fix pacman provider tests
  (PUP-1905) Split modulepath when supplied as an override from CLI
  (PUP-1897) Improve test of EPP trim, and expr after params
  (PUP-1897) Fix failing lexer2 test, and update with additional tests
  (PUP-1897) Change epp lexer/grammar to only accept single rendered expr
  (PUP-979) Fix unparenthesized calls with hash to not give strange error
  (PUP-1897) Allow EPP render expression to render a block
  (maint) Remove dead-code check if ImportExpression is r-value
  (maint) Remove dead code checking non existing ImportExpression
  (PUP-1898) Fix reference to ArgumentException
  (PUP-1898) Fix broken exception raising when inline_epp gets non string
  (PUP-1895) Change <%( )%> to <%| |%> for EPP parameters
  (maint) Fix parallel:spec rake task when dependencies are not present.
  (Maint) Remove some duplication in tests
  (PUP-1885) Stringify ignores for file serving
  (PUP-1563) Don't recurse when dependencies are empty
  (PUP-1563) resolve_install_conflicts excessively recurses
  (maint) Add rake task for parallelizing specs.
  (PUP-30) Fix problem with changed behavior in StringScanner.scan_until
  (PUP-30) Add tests of inline_epp function
  ...
Merge pull request #2247 from ffrank/ticket/master/1581-purge-all-ssh-keys

(PUP-1174) enable the purging of authorized ssh keys
(maint) Fix face_collection_spec to properly restore global state.

The spec attempts to restore global state stored in
Puppet::Interface::FaceCollection so that it doesn't interfere with
other specs that may use faces.

It fails to clear any files required by the autoloader, but clears the
@faces member.  The result is that if a face is referenced again from
another spec, it doesn't get defined and added to @faces and cannot be
found.

The fix is to clear the state before and after each example.

The problem can be observed with the following:
rspec spec/unit/interface/face_collection_spec.rb spec/unit/application/face_base_spec.rb

This closes GH-2422.
(maint) Use provider property accessors in the Cron type

ParsedFiles is the only provider which actually creates an accessor to expose
the internal `@property_hash` of provider instances. This patch replaces
uses of `property_hash` in the Cron type with the `target` accessor method that
providers define for the `target` property.
Merge pull request #2385 from ffrank/ticket/master/PUP-1041-nagios-parse-blank

(PUP-1041) nagios: parse empty parameter values in definitions