(PUP-3035) Add /var/run/puppet to debian packaging

Previously /var/run/puppet was created only during service start on
debian for both puppet and puppetmaster services. However, as it is used
in both of those services, it makes sense to have it owned and created
by one of the puppet packages. puppet-common is a dependency of both the
puppet and puppetmaster packages, so this commit adds /var/run/puppet to
the puppet-common.dirs file so it will be created in that package. This
also brings parity between redhat and debian packages in this respect,
as redhat puppet packages create the /var/run/puppet directory already.
This also adds a dpkg-statoverride call to manage permissions for the
/var/run/puppet directory.
(PUP-3035) Refactor dpkg-statoverride calls in puppet-common.postinst

This commit does some simple refactoring int he puppet-common.postinst
to avoid some unneeded repetition.
(PUP-2349) Force mode property to be a string

The initial commit for this ticket missed the case where
the mode value isn't explicitly specified but rather comes from
source permissions of a file resource, e.g. as happens during
pluginsync.

This change ensures that mode from a source permission is
converted to an octal string if it's a Numeric.
(PUP-2349) Specify mode as an octal string consistently in spec manifest snippets

In the puppet 4.0 parser, the file resource's mode property will be
required to be a string containing an octal (or symbolic) representation
of mode.

For consistency then, this commit changes all cases where mode was
specified as a Numeric to be a string containing an octal representation
of mode (always prefaced with a 0, again for clarity and consistency).
Merge pull request #3022 from kylog/issue/pup-2349/cleanup-warning-during-pluginsync

(PUP-2349) cleanup warning during pluginsync.
Merge pull request #3001 from haus/ticket/master/pup-3035-add-var-run-puppet-to-debian-packaging

(PUP-3035) Add /var/run/puppet to debian packaging
(PUP-3154) Create and manage the mode of $statedir on redhat

In debian, we create and manage the $statedir in the postinst of the
puppet-common package. In redhat, $statedir would be created on
service start, and owned by root. This means that other applications,
even those in the puppet group, could not write to this directory. This
commit adds $statedir to the directories created in the redhat package
and sets the user and group ownership to puppet:puppet. This will ensure
a more consistent experience for users of our packages.
(PUP-1884) Migrate MSI deps into puppet repo

We have this problem where it is very difficult to know what exactly is
getting into the Puppet MSI when we build it. Previously, all that
information was stored in the Jenkins job used to build the MSI. This
proved difficult because there is no real way to audit changes made to
Jenkins jobs, why those changes were made, or who made them. This commit
moves that information into the Puppet Repo itself. This will help us
make sure the correct version of each project is getting into the MSI,
and allow us to build the MSI with the current checkout of the Puppet
Repo. However, this means we have to make sure we do not forget to
update the versions of the dependencies getting pulled into the MSI when
a new release happens.
Merge pull request #3030 from haus/ticket/master/pup-3154-manage-statedir-in-redhat-packaging

(PUP-3154) Create and manage the mode of $statedir on redhat
Merge pull request #3020 from melissaanne/ticket/master/pupet-1884

(PUP-1884) Migrate MSI deps into puppet repo
(PUP-2984) Remove old installation directory when going from x64 to x86

Update dependency on puppet_for_the_win:

https://github.com/puppetlabs/puppet_for_the_win/commit/c61dda253b09bd855488f7b6dd7332fdf84d3039
(PUP-3153) Guard against nil when closing Uniquefiles

In a recent commit we introduced `Uniquefile` to use in place
of `Tempfile` for certain code paths.  Because `Uniquefile` does
not automatically delete files for you, it is necessary to call
`close!` explicitly if you wish to make sure that they get
removed.

In the original commit I did this in a few places in an `ensure`
block.  However, I did not guard against the possibility that
an error might occur when attempting to instantiate the `Uniquefile`
object (e.g., file permissions error), and thus the calls to `close!`
in the `ensure` blocks may result in a NilClass exception (and also
mask the real error).

This commit adds guards to ensure that we only try to call `close!`
if the `Uniquefile` object was actually instantiated.
PUP-3155 Improve spec tests around the PE puppet version

Before this commit, when checking the puppet version on a PE build,
several characters; '(', ')' and '.'; caused problems with the regex.
This commit Regexp.escape-s them.
Merge pull request #3029 from cprice404/bug/master/PUP-3153-guard-against-nil-when-closing-uniquefiles

(PUP-3153) Guard against nil when closing Uniquefiles
Merge pull request #3031 from andersonmills/fix/master/PUP-3155-improve_pe_version_spec_tests

PUP-3155 Improve spec tests around the PE puppet version