Add packaging support for fedora 17

This commit modifies the puppet.spec file to use
the ruby vendorlib instead of sitelib if building
for fedora 17, which ships with ruby 1.9. Mostly
borrowed from the official Fedora 17 package.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Merge pull request #1017 from MosesMendoza/maint/2.7rc/update_spec_for_fedora_17

Add packaging support for fedora 17
maint: Refactor suntab and aixtab filetype

Apply the create/do_stuff/delete cycle of a temp file that is explained
in tempfile.rb to the suntab and aixtab filetype. This way the temporary
file should always be removed.

The name of the temporary file was changed so it will be easier to stub
this single call in tests - without stubbing tempfile creations in other
places (like inside Puppet::Util.execute) at the same time.
(#14283) Fix suntab filetype when run as normal user

Running puppet as an unpriviledged user to manage its own crontab caused
two problems under solaris:

The uid argument was passed to the execute method to set the correct uid
before executing the crontab command. The execute method has a default
argumenthash with the key :failonfail set to true. Because the suntab
filetype passed it's own hash, failonfail was nil so if crontab
completes with a non-zero exit code no error will be raised.

This is bad because running execute with :uid not only sets the correct
userid in the child process but also tries to run `Process.initgroups`
to set the correct supplementary groups of that user. This call will most
likely fail as a non priviledged user causing the whole child process to fail.

The fix now makes sure that failonfail is passed to the execute method
so failures can be handled correctly and uid is only passed if necessary
(which is not the case when the target user in the crontab resource is
the same user that is running puppet).

Since the execute method now raises an exception on non-zero exit
codes, we have to handle the case where the crontab file doesn't exist
for the user (and return '') versus other fatal errors.
(#15291) Add Vendor tag to Puppet spec file

Previously the spec file had no Vendor tag, which left it undefined. This
commit adds a Vendor tag that references the _host_vendor macro, so that it can
be easily set to 'Puppet Labs' internally and customized by users easily. The
Vendor tag makes it easier for users to tell where the package came from.
Merge pull request #1023 from haus/ticket/2.7rc/15291_add_vendor_field

(#15291) Add Vendor tag to Puppet spec file
Ruby 1.9.3 has a different error when `require` fails.

The text of the error message when load fails has changed, resulting in the
test failing.  This adapts that to catch the different versions, allowing this
to pass in all cases.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge pull request #1024 from haus/ticket/2.7rc/11325_fix_load_failure_regex

Ruby 1.9.3 has a different error when `require` fails.
(maint) Include backtrace in re-raised exception

Previously, there were places where a rescued exception's message was
not included in the newly raised exception. We also were not preserving
the backtrace, which makes debugging more difficult.

This commit ensures the original message and backtrace are included in
the newly raise exception.
(maint) Whitespace cleanup

Previously there was trailing whitespace and lines indented 4 spaces.
Just reformatted the file, no code changes.
(maint) Remove spurious `puts` line

Previously, the suntab's write method was printing the contents of the
crontab file to stdout.
(maint) Consolidate flat file tests

Previously the flat file tests were split into two example groups at the
beginning and end of the file. This commit just consolidates them into a
single example group.
(maint) Refactor filetype specs

This commit refactors the filetype specs to use `let`, especially the
arguments passed to the execute method.

It also adds a shared behavior for crontab file types and refactors the
suntab type to use it.
(#14283) Raise an error when crontab returns non-zero on AIX

Previously, the AIX crontab filetype had the same issue as the Sun one,
the `:failonfail` argument was being set to false, so it would not raise
an error when crontab returned a non-zero exit code. The only time the
filetype raised an exception was if the command output contained the
line: 'You are not authorized to use the cron command'

This commit changes the AIX crontab filetype to raise an exception if
crontab returns a non-zero exit code.

If the user doesn't have any crontab entries, then the `#read` method
will return an empty string as is done for on Solaris.

If the command failed because the user doesn't have permission, then the
filetype will raise an exception, as it did before.

This commit also adds tests and an AIX crontab fixture.
(#14283) Call Tempfile#close and #unlink separately

Previously, we were calling `Tempfile#close!` which under ruby 1.8.7
will call the finalizer's cleanup routine directly. That may raise an
exception, e.g. Errno::EACCES, if the process is unable to unlink the
file, i.e. Windows. In ruby 1.9, the `Tempfile#close!` method was
changed to provide the same semantics as `#close` followed by `#unlink`.
Rather than monkey patch Tempfile, we simply call close followed by
unlink explicitly.
Update CHANGELOG, conf/redhat/puppet.spec for 2.7.19rc3
Merge branch '2.7rc' into 2.7.x
Merge pull request #1025 from joshcooper/ticket/2.7.x/14283-filetype-uid

(#14283) Fix suntab and aixtab when run as unprivileged user
(Maint) Skip crontab filetype tests on Windows

The tests were failing due to `Puppet::Util.uid` not being implemented on
Windows. Since crontab filetypes are not something that will ever be
supported on Windows, this commit skips those specific tests.
(#15912) Make function access consistent

Parser functions are normally stored against either the root environment or
the current environment. Before this commit, methods to access functions were
not consistent about retrieving functions from both possible places. This adds
a set of private methods to consistently access functions, and makes the
public methods use these.

Paired-with: Josh Cooper <josh@puppetlabs.com>