(maint) Windows failing spec fixes

 - The usage of Dir.getwd in tests has been simplified to
   File.expand_path to properly handle mixed case CWD
 - util_spec.rb ensures 'FOO' Env var cleared before test starts
 - Windows SID checks should be performed as a regex match to
    properly handle all accounts starting with S-1-5-*, which denotes
    accounts with an identifier authority of SECURITY_NT_AUTHORITY
    instead of hardcoding S-1-5-32-544, the Administrators group
(maint) Changing rescue of Exception to StandardError

Rescuing exception is in general a bad practice and can cause undesired behaviors.

A detailed discussion about this can be found here: https://github.com/puppetlabs/puppet/pull/1925#discussion_r6529813
(#4506) Don't serialize transient vars in Puppet::Resource

When serializing Ruby objects to YAML, Procs may be serialized that
cannot be deserialized. Given the following example:

    YAML.load(YAML.dump lambda { "hi" })

A TypeError is raised with the message "allocator undefined for Proc".

Commit e161cbc introduced a new instance variable to Puppet::Resource,
`@rstype`, which was the serialized resource_type for the given object.
When a Puppet::Resource object was round tripped from YAML the
deserialization would fail with the above TypeError. Using Puppet's
built in deserialization (EG `Puppet::Resource.convert_from('yaml', serialized_data)`)
would work, but directly parsing the YAML would fail.

To resolve this an explicit list of instance variables is specified for
serialization, so instead of trying to serialize everything we only
serialize the things we need.
(#22665) mounts should autorequire parent mounts

Given two mount points:

    mount { "/var/log":
      # ...
    }

    mount { "/var":
      # ...
    }

The mount '/var/log' should autorequire '/var' so that the child mount
is not masked by the parent mount.
(#21971) Create test to show exploit of resource_type

This test creates a file in the tmp directory on the master, opens up
access to the resource_type endpoint, and then makes a request that
causes the file placed in tmp to be evaluated. If the exploit works,
then a file is placed in /tmp on the master.
(#21971) Add test for accessing based on master being at root

The master process, when it daemonized, switches the current working
directory to /. This means that all paths are easily knowable by a user
and no directory traversal is needed to get to any file on the file
system. The type loading code does not protect from this by making sure
that any types that are requested only appear in the known-good
directories (the manifest dirs in the modulepath) and so can be caused
to load code from anywhere on the system.
(maint) Remove constant and requires now provided in spec_helper
(maint) Factor a duplicated constant up to spec_helper
Merge branch 'stable'

* stable:
  (#21971) Add test for accessing based on master being at root
  (#21971) Create test to show exploit of resource_type
Merge pull request #1952 from jjulien/fix_exception

(maint) Changing rescue of Exception to StandardError
Merge pull request #1967 from kylog/maint/one-more-fixup-for-already-initialized-constant-warning

Maint/one more fixup for already initialized constant warning
Doc cleanup on create_resources example

The two items in the hash must be separated by a comma and group isn't a valid parameter to the user resource.
(doc) Merge branch 'nibalizer-patch-1' into stable

* nibalizer-patch-1:
  Doc cleanup on create_resources example

Documentation only update, merging into stable.
Merge branch 'stable'

* stable:
  Doc cleanup on create_resources example
(#22772) Fix test for saving empty data

This test was failing due to a bug in the test, which didn't show up because
it was checking for too broad of an error.
(#22772) Allow a PUT with an empty body
(#22772) Add error checking to yaml format

This will raise a FormatError if asked to intern invalid YAML instead of an
unintelligible ruby error.
Merge pull request #1949 from adrienthebo/ticket/master/4506-define_puppet_resource_yaml_properties

(#4506) Don't serialize transient vars in Puppet::Resource
Merge pull request #1935 from adrienthebo/issue_22665-require_mount_parents

(#22665) mounts should autorequire parent mounts
Merge pull request #1969 from pcarlisle/ticket/22772-empty-filebucket-save

Fix saving empty files to filebucket