(#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.
Merge branch 'ticket/2.7.x/15521-use_dynamic_forge_locale_for_acceptance' of git://github.com/kbarber/puppet into 2.7.x

* 'ticket/2.7.x/15521-use_dynamic_forge_locale_for_acceptance' of git://github.com/kbarber/puppet:
  (#15521) Convert to using host stub wrapper
(Maint) Add logging for when Puppet is enabled/disabled.

Someone keeps disabling Puppet on our machines and we have no easy way
to quickly check logfiles to see what happened.

This patch fixes the problem by logging Puppet enable and disable state
changes using `Puppet.notice`.
Merge branch 'maint/2.7.x/log_agent_enable_disable' into 2.7.x

* maint/2.7.x/log_agent_enable_disable:
  (Maint) Add logging for when Puppet is enabled/disabled.
(#15346) add --source to the gem list command

Without this patch the `gem list` command in the gem package provider
will search all package repositories.  This is a problem because the end
user is likely expecting Puppet to only search the specified repository
instead of all repositories.

This patch fixes the problem by passing the source parameter value onto
the gem list command as the `--source` command line option.

    Commit message amended by Jeff McCune <jeff@puppetlabs.com>
(#15346) Add spec test for --source when checking latest

This patch adds a single spec test to ensure checking the latest version
of the gem honors the source attribute and passes this as an option to
the gemlist method.
Merge branch 'ticket/2.7.x/15346_add_gem_source_parameter' into 2.7.x

* ticket/2.7.x/15346_add_gem_source_parameter:
  (#15346) Add spec test for --source when checking latest
  (#15346) add --source to the gem list command
Merge branch '2.7.x' into 3.x

* 2.7.x:
  (#15346) Add spec test for --source when checking latest
  (#15346) add --source to the gem list command
  (Maint) Add logging for when Puppet is enabled/disabled.
  (#15521) Convert to using host stub wrapper

Conflicts:
	acceptance/tests/modules/install/nonexistent_directory.rb
	acceptance/tests/modules/search/by_description.rb
	acceptance/tests/modules/search/by_keyword.rb
	acceptance/tests/modules/search/by_module_name.rb
	acceptance/tests/modules/search/communication_error.rb
	acceptance/tests/modules/search/formatting.rb
	acceptance/tests/modules/search/multiple_search_terms.rb
	acceptance/tests/modules/search/no_results.rb
	lib/puppet/agent/locker.rb
Merge pull request #1034 from vrthra/maint_fix_locale

(Maint) Fix assertion about locale to correct value.
(#11870) Pass a list of Arrays to multiple_yields

Previously, I was passing a list of packages to mocha's multiple_yields,
which on ruby 1.9.3-p0 results in an unexpected call to the `to_a`
method on the mock object, but on 1.8.7 and later versions of 1.9.3 does
not.

The real issue is that I'm not calling multiple_yields correctly:

  Note that each +parameter_group+ should be an Array representing the
  parameters to be passed to the block for a single yield.

This commit changes it to pass a list of Arrays, where each element in
the array is yielded in turn (as opposed to the Array itself).

This commit also adds names to the mock objects to assist with debugging
when the expectation fails.
Merge branch 'maint/3.x/ruby193p0' into 3.x

* maint/3.x/ruby193p0:
  (#11870) Pass a list of Arrays to multiple_yields
(Maint) Include the registry key path in the exception

Previously, it wasn't clear from the exception message which registry key
we failed to open.

This commit adds the registry key path to the message to debug issues we
are seeing in CI, but is also generally helpful.
Merge branch 'maint/3.x/include_key_path' into 3.x

* maint/3.x/include_key_path:
  (Maint) Include the registry key path in the exception
(#11870) Ignore uninstall keys that don't exist

Previously, we assumed the 4 combinations of (HKLM or HKCU) and (32 or
64) registry paths always existed. When running puppet in an interactive
logon session, this assumption appears to hold. However, when puppet
runs as a service (under LocalSystem), the assumption fails as the
registry key `Software\Microsoft\Windows\CurrentVersion\Uninstall`
typically does not exist within the HKEY_CURRENT_USER hive. In that
case, we would fail to enumerate the set of installed products.

This commit changes the enumeration code to ignore errors that occur
when the Uninstall key for a particular combination does not exist. This
corresponds the Windows error code ERROR_FILE_NOT_FOUND[1]

However, if an exception occurs for other reasons, e.g.
ERROR_ACCESS_DENIED, then we re-raise the exception and fail.

Also, the inner `open` call should never fail with ERROR_FILE_NOT_FOUND
because we get a list of subkeys for the Uninstall key, and then open each
subkey in turn.

[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
Merge branch 'ticket/3.x/11870-skip-absent-keys' into 3.x

* ticket/3.x/11870-skip-absent-keys:
  (#11870) Ignore uninstall keys that don't exist
Fix missing forge stub and directory check due to test change in 3.x branch rollup

This fixes a test error that was being thrown by the
modules/install/nonexistent_directory.rb file.

In recent commits we added a more clever way to stub the forge host in 2.7.x,
and obtain a forge hostname. This test however went from being a non-network
capable test to a networked one in 3.x, so the rollup from 2.7.x->3.x meant our
changes weren't applied to this particular case. This patch fixes that by
adding the correct stubbing method 'stub_forge_on' to the top of the file.

It also corrects a negated directory check which creaped in during merge up and
ensures proper cleanup using the new teardown mechanism (like the other tests).
Merge branch 'kbarber-ticket/3.x/pmt_missing_stub_on_test_nonexistent_dir' into 3.x

* kbarber-ticket/3.x/pmt_missing_stub_on_test_nonexistent_dir:
  Fix missing forge stub and directory check due to test change in 3.x branch rollup
(#8200) Fix global parameter validation

Previously we used `self[:ensure] != :absent` as a check to ensure that the
global validate block is not entered unless it was an instance creation
call. However, the `self[:ensure]` values seem to have multiple values
including "absent" and nil. It is now changed to
`provider.get(:ensure) == absent`, which seems to be set during an
instance creation call. (pending full refactoring of zones type)

Paired with Josh Cooper <JoshCooper@puppetlabs.com>