(maint) Add specs for parser resource parameters

Classes Puppet::Parser::AST::ResourceParam and Puppet::Parser::Resource::Param
(#23115) Include manifest context in Puppet::DevError

When a 'devfail' or Puppet::DevError is thrown, include the user's manifest
file/line context as it can help in finding the problem.
(#23115) Convert nil resource parameter values to undef

If a resource parameter evaluates to nil (e.g. a return value from a parser
function), then convert the value to undef.  This prevents an error in
Puppet::Parser::Resource::Param which requires a non-nil value on
instantiation.
(maint) Fix the 'nothing to manage' message.

In the refactoring for #23081, in commit 6ff0a103, the message
"Nothing to manage; no ensure and the resource doesn't exist"
was introduced.  However, this message would spuriously fire
if the resource was in fact managed by an ensure property, e.g.

rm -rf /tmp/foo; be puppet apply -e 'file {"/tmp/foo": ensure => present}' --debug

This patch corrects that spurious debug message.
Merge pull request #2075 from kylog/maint/fix-nothing-to-manage-debug-message

(maint) Fix the 'nothing to manage' message.
(#19447) Puppet::FileSystem::File Windows symlink

 - Windows symlink support has been added to exist?, symlink, symlink?,
   readlink, stat, and lstat.  This overrides any usage of Ruby File or
   FileTest classes which are completely borked on Windows.
 - :manages_symlinks feature of the file provider is enabled with a
   check against Puppet.features.manages_symlinks? which checks for the
   existence of the CreateSymbolicLink call in kernel32.dll
 - FFI wrappers for Win32 API calls CreateSymbolicLink, CreateFile,
   GetFileAttributes, DeviceIoControl and CloseHandle added to
   windows/file
   NOTE: The DeviceIoControl method of resolving symlinks was used
   instead of GetFinalPathNameByHandle, which is known to misbehave
   with UNC paths
 - Any tests against :manages_symlinks feature are automatically turned
   on for Windows, increasing test count by approximately 42 new tests
 - Removed a few symlink tests that were confined to any OS other than
   Windows since they must now be adjusted to run on Windows versions
   that we know support symlinks
 - Updated symlink documentation based on ileUtils.symlink behavior
(#19447) Windows symlink check process token

 - Windows symlink support is enabled not only by the existence
   of the CreateSymbolicLink API call, but also by checking the
   current process token for the SeCreateSymbolicLinkPrivilege
 - Inspired by http://stackoverflow.com/a/2129589
(#19447) check Puppet.features.manages_symlinks?

 - Replace calls to the specific :file provider with the global
   Puppet.features call
(#19447) Rewrite symlink tests for file type

 - These old tests haven't been running since 2010 due to how RSpec was
 setup, and were incorrect
 - Rewrite to let Puppet manage file content, and clean up for better
 readability / maintainability
Maint: Re-word doc string for file type's ensure property

This commit makes the Windows situation with symlinks a bit more clear, and
hopefully clarifies the available values in general.
(#19447) Check for symlink permission only if we try to create one

Previously, puppet would always issue a symlink privilege warning,
even when not managing symlinks.

This commit changes it to only check for the permission if we are
about to create a symlink, and also uses `Puppet.warning` instead of
`Kernel.warn`.
(#19447) Fall back to stat if we don't support symlinks

Previously, when managing a file with a source parameter pointing to a
local file, the file resource and file serving code would try to call
`Puppet::FileSystem::File.lstat`, without knowing if the path referred
to a link or not. In other words, the method can be called on things
other than a link, and shouldn't fail when symlinks aren't supported,
i.e. windows 2003.

We could change all of the callers to check if the path is a link and
then only call `lstat`, but that seemed more risky. This commit just
changes the windows `lstat` method to fall back to stat in the 2003
case.
(#19447) Fully qualify access to ruby `File`

This commit just ensures that we call the ruby File methods, as
opposed to Puppet::FileSystem::File, which is at the same "level" as
this class. It also explicitly requires the windows util code to
ensure there aren't load order issues.
(#19447) Rescue when symlink privilege does not exist

Previously, the process_privilege_symlink? would raise on 2003 instead
of returning FALSE.

Now we rescue the ERROR_NO_SUCH_PRIVILEGE when trying to lookup
SeCreateSymbolicLinkPrivilege.
(#19447) Skip symlink test if provider doesn't support it

Confine the tests to when the provider supports symlinks.

Note how the shared examples are invoked if the windows host supports
symlinks. Putting the check inside the "metadata collector symlinks"
shared example causes the "on Windows" outer example groups before each
block to be executed on non-windows platforms.
Merge branch 'ticket/master/19447-windows-symlinks'

* ticket/master/19447-windows-symlinks:
  (#19447) Skip symlink test if provider doesn't support it
  (#19447) Rescue when symlink privilege does not exist
  (#19447) Fully qualify access to ruby `File`
  (#19447) Fall back to stat if we don't support symlinks
  (#19447) Check for symlink permission only if we try to create one
  Maint: Re-word doc string for file type's ensure property
  (#19447) Rewrite symlink tests for file type
  (#19447) check Puppet.features.manages_symlinks?
  (#19447) Windows symlink check process token
  (#19447) Puppet::FileSystem::File Windows symlink

Closes GH-1997
(Maint) Allow acceptance tests to be run on preserved windows hosts

Previously, running acceptance tests on a preserved windows host would
fail, because the puppet-win32-ruby directory already existed from the
previous run, and git clone will report a fatal error.

This commit uses beaker's method for cloning a repo. The method handles
things like only cloning if necessary, resetting remotes, and cleaning
existing workspaces.
(maint) Don't stand up master unless resigning.

Don't take the time to bring up a puppet master unless we intend to
recreate certs.

Also clears and resets the master's cert if it has the agent role.
There is no reason to treat the master specially in this case.
(#7243) Allow CSRs to accept a set of custom attributes

When a CSR is generated, additional information may need to be attached
to the CSR for use when the CSR is signed. This commit allows an
additional hash of OID/value pairs to be included as CSR attributes when
the CSR is generated.

To ensure that user specified attributes cannot overwrite attributes
added by Puppet itself, adding attributes that deal with certificate extension
requests will fail the CSR generation process.

Original patch by Patrick Hemmer <patrick.hemmer@gmail.com>
Merge pull request #2078 from jpartlow/feature/7243/csr-attributes-test

Feature/7243/csr attributes test