(#18931) Add setting to control how remote metadata is copied

WTF, this is wrong, this needs to be a file parameter

Previously, when puppet applied a file resource with a remote source,
e.g. `source => 'puppet:///...', it would always copy the owner, group,
and mode values from the remote file to the local file, even if those
properties were not being managed.

This affected both newly created files (#5240) and modifying existing
ones (#18931). This behavior goes against puppet's principle of only
managing properties of the resource that are specified in the manifest.

The behavior has security implications on Unix, as there are no guarantees
that the uid/gid on the remote system refer to the same accounts on the
local system. It also has security implications on Windows, due to
puppet breaking filesystem inheritance. However, this behavior has
existed since at least 0.25.0.

This commit adds a setting `source_permissions` whose values are
`always`, `creates`, or `never`, where `always` corresponds to the
existing behavior, and is the default. The `creates` value will cause
puppet to only copy owner, group, and mode from the remote site when
creating the file resource (file, directory, or link), but not when
managing an existing file. The `never` value will cause puppet to never
copy owner, group, and mode from the remote side.

Note that if you specify an owner, group, and/or mode property in the
manifest, then that will always managed and take precedence over the
remote values.
(#18931) Make non-root puppet not set group on files.

Previously there was code so that non-root puppet would not
atttempt to set owner on files (makes sense).  The same logic
applies to group, so this patch simply extends that same code
so that non-root puppet doesn't attempt to set group on files.
(#18931) Convert source_permissions from Puppet setting to file param
(#18931) Refactor slightly for readability

Minor cleanup:
* be consistent about accessing resource member sans @
* refactor copy_source_values for readability
* mark two methods private
(#18931) Replace 'puppetmaster' with 'puppet master'
(#18931) Rename source_permissions param values

After some discussion with Nick, this patch renames the three
values of the source_permissions:
* always -> use
* creates -> use_when_creating
* never -> ignore

The concern with the previous names is that 'always' and 'never'
might mislead a user to think that this overrode managed values
for owner/group/mode, when in fact the source_permissions param
only refers to behavior for *unmanaged* values.  So 'use'/'ignore'
don't carry that absolute implication while still describing the
behavior.  'use_when_creating' is a little long and awkward, but
also expected to be the least used option.
(#18931) Convert the mode to a string for consistency.

In commit 3e592777 file modes were converted from an integer
to an octal string, but missed this one location.  For those of
us who don't convert octal to decimal immediately, this was
confusing.  This patch uses strings for mode consistently,
at least within this file.
(#18931) Extend tests for local

Add tests to verify that local trumps source_permissions across the board.
Add verification that the mode is copied for local sources.
(#18931) Improve warning messages on windows

Previous to this change a windows agent could
see a deprecation warning even if the manifests
explicitly specified ignore if, say, pluginsync
tripped the copy_source_values logic.

Also previous to this change, a manifest could
specify source_permissions => use_when_creating
for Windows agents, although that makes no more sense
than source_permissions => use for Windows agent.

So this change:
* only issues a warning if the manifest explicity
  specifies source_permissions => use or
  source_permissions = use_when_creating, since
  those settings aren't desirable on windows
* disallows use_when_creating on windows agents
(#18931) Pluginsync ignores source permissions by default on Windows

Files that are brought in from plugins should set `source_permissions =>
:ignore` by default on Windows. This would suppress any warnings that the
user has no control over as they are not coming from the host catalog.
Merge branch 'ticket/master/18931-source-permissions'
Merge branch 'master' of https://github.com/puppetlabs/puppet