(Maint): Re-enable tests on Windows

These tests now pass on Windows.  Removed the `pending` block and
re-indented, no code changes.
(#11870) Add registry module

Ruby includes a built-in set of modules and classes for interacting with
the registry, however, it is only present on Windows.  This makes it
difficult to write spec tests that can run on non-Windows platforms due to
the `Win32` namespace and related constants.

This commit adds a utility module to wrap the Windows specific code.  This
way if you write a module/class that uses the registry, you can just add
expects/stub expectations to the utility module or the class that
includes/extends it.
(#11870) Refactor windows-specific requires

Previously, we were explicitly requiring windows-specific code, which
made it hard to write spec tests that still run on non-Windows platforms.

This commit refactors the requires into the
`Puppet.features.microsoft_windows?` definition, so that if we are on
Windows all of our dependencies will be satisified, and if we're not on
Windows, we won't accidentally load code that doesn't apply.  Also,
re-ordered the dependencies based on where they come from, e.g. ruby vs
gem.
(#11870) Add package options parameter

This commit adds a new package options parameter type that accepts an
array of strings or hashes. For example,

    [ 'arg1', { 'key2' => 'val2', 'key2' => 'val3' }, 'arg4' ]

The parameter preserves the order of array elements, as it may be
significant for a provider, e.g. '--source', 'URL'. Order of hash
key-value pairs is based on the natural sort order of the keys. Any
argument containing spaces will automatically be quoted, so that you don't
have to check that in each manifest.

The package options parameter is not currently used, but will be in a
future commit to enable install and uninstall options to be passed to the
package provider.

Oddly, if any puppet parameter is specifed as an array with one element,
puppet's parser-based resource will automatically de-arrify it (see commit
46252b5b). As a result, if an array is a valid value, then the validate &
munge methods cannot reject an element that isn't an array.

Therefore, the package options munge method arrayifies values, which has
the side-efect that it will accept the 2.7.x style way of declaring
install_options for MSI packages. Moreso, it means that the old way cannot
be deprecated without changing core puppet behavior.
(#15521) Convert to using host stub wrapper

This patch converts the module acceptance code to using the host stub wrapper
now provided in puppet-acceptance: `stub_forge_on`.

This will allow us to change the forge host we are stubbing dynamically as
apposed to manually changing it everywhere in acceptance code.

This also changes the cases where we have teardown code to use the new
`teardown` block, and to use `rm -rf` for file cleanup to avoid puppet backup
duplication issues.
Don't issue deprecation warnings for allow_ip

A deprecation warning was issued when IP addresses were used with allow. One
had slipped through and was still printing when allow_ip was used.
(#11870) Refactor the MSI provider to use package options

Previously, the MSI provider contained logic for accepting a hash of
`install_options`. The provider's install method flattened the hash pairs
as:

    "key1=value1 key2=value2"

and passed that to msiexec.exe. This worked fine for MSI public
properties, but does not account for passing single arguments.

This commit refactors the provider to use the more generic version of
`install_options`, which expects an array of values. For example, if a
manifest contains:

    [ '/S', { 'INSTALLDIR' => 'C:\Program Files' } ]

then msiexec will be invoked with:

    "/S INSTALLDIR=\"C:\\Program Files\""

The only change in behavior is that the MSI provider will now accept
single arguments and pass those onto msiexec.
(#11870) Add the ability to specify uninstall_options

Previously, the MSI provider was unable to specify uninstall_options.
This isn't typically an issue, since Windows stores the command and
arguments necessary to uninstall the package in the `UninstallString`
registry value associated with the package.

But there are some MSI packages that require this functionality, e.g. to
specify VMware Tools modules to uninstall:

   msiexec.exe /x <productcode> REMOVE=Sync,VSS,...

This commit adds an `uninstall_options` parameter to the package type and
updates the MSI provider to use it. It has the same format as
`install_options`.
(#11870) Deprecate the `:msi` provider

The `:msi` package provider is being deprecated and replaced with the
`:windows` provider. Attempting to install or uninstall a package using
the msi provider will cause puppet to issue a deprecation warning.

The windows provider is basically a copy of the MSI provider, though it
will be capable of managing executable packages in a future commit.
(#11870) Refactor package management logic for MSI

This commit moves the logic for querying, installing and uninstalling MSI
packages into a MsiPackage class separate from the main windows package
provider. This is being done in preparation for adding executable package
support (as some of the logic is very similar), such as querying the
registry for installed products. Additionally, executable and MSI
packages can be related, which makes partitioning the set of installed
packages into different MSI and executable providers not really feasible.
(#11870) Manage executable packages on Windows

Previously, puppet could only manage MSI packages on Windows. This commit
extends the `:windows` package provider so that it can query, install, and
uninstall executable packages. The logic for this is borrowed from[1].

Basically, puppet will only manage executable packages that have the
following attributes:

    Non-empty DisplayName
    Non-empty UninstallString
    Are not SystemComponents
    Are not WindowsInstaller
    Names don't start with KBXXXXXX
    Are not part of another product (ParentKeyName)
    Are not Security Update, Update Rollup or Hotfix

For example, to install Java silently:

    package { 'Java(TM) 7 Update 5':
      ensure          => installed,
      source          => '...\jre-7u5-windows-i586.exe',
      install_options => [
        '/s', '/v/qn" ADDLOCAL=jrecore REBOOT=Suppress JAVAUPDATE=0"'
      ]
    }

[1] http://community.spiceworks.com/how_to/show/2238
(#15644) add test case to check for packages that are yet to be installed.

Added the check for latest value in the test case,
Added a new test case that checks for correct behavior in case the
package is not installed.
(#8200) validate only if we can (especially path)

The global validate block is called even when `puppet resource zone` is
called without any further arguments, so we add a check
provider.get(:ensure) != :absent to make sure that we are indeed in
zone creation stage before trying to validate. This could have been
better done by `isrequired` method in parameter.rb however this is not
hooked up now, so we are uanble to use it..

The ip validation is refactored to make it clearer to read.
(Maint) Removed unnecessary stubbing

Previously, the spec test stubbed the zone resource. This commit creates
a real resource specifying the provider to use. It also adds the type of
exception and message that we're expecting to be raised.

Paired-with: Rahul Gopinath <rahul@puppetlabs.com>
Merge branch 'ticket/3.x/8200_validate_param' into 3.x

* ticket/3.x/8200_validate_param:
  (Maint) Removed unnecessary stubbing
  (#8200) validate only if we can (especially path)
(#7175) ensure ensurable uses symbols in zone

zone provider when asked to ensure the state to running/install or any
thing tries to find the value in state_index however, state_index values
stores keys as string. This is wrong. The root cause is that
ensurable returns values as string rather than symbols. This inturn is
caused by state_name checking for string value in state_alias which is a
symbol to symbol map, and not finding any, and returning itself.
(#15644) refactor the parse_line so that it supports the newer format

Previously the parse_line conflated the different output formats of the
older and newer `pkg list` commands. This commit splits the formats to
separate regexes so that it is easier to manage. Especially if the pkg
list format changes yet again.

This commit simplifies self.instances, latest and query methods by
removing redundant lines.

Adds more comments to the methods, and changes the method names to reflect the
method usage.

Tests:
- Update the package list output so that the format is correct
(it is ufoxi - 5 dashes)

- Earlier, when a pkg list line could not be parsed, the provider warned
the user about this fact and continued. This behavior is dangerous. We
change it to fail instead.

- Added more test cases.
(#15644) ensure that pkg installation is non-interactive

Earlier, pkg install did not have --accept parameter, which means that
licenses would not be automatically accepted. Since puppet is a
non-interactive process, this is not the correct behavior. This commit
adds the --accept parameter to accept licenses during pkg installation.

Earlier, pkg uninstall added -r always to the command for recursive
uninstall. However, this was removed in the later version of the pkg
command. This commit adds the logic to check for the version before
doing `pkg uninstall -r mypkg`
Merge branch 'ticket/3.x/7175-symbolize' into 3.x

* ticket/3.x/7175-symbolize:
  (#7175) ensure ensurable uses symbols in zone
  (Maint) Removed unnecessary stubbing
  (#8200) validate only if we can (especially path)
Merge branch 'ticket/3.x/15644_fix_parse_line' into 3.x

* ticket/3.x/15644_fix_parse_line:
  (#15644) ensure that pkg installation is non-interactive
  (#15644) refactor the parse_line so that it supports the newer format
  (#15644) add test case to check for packages that are yet to be installed.