Revert "Revert "Merge branch 'nicklewis-rcS-is-a-jerk' into stable""

This reverts commit dd4d41e97fe21c9bd9f628fb4f982aead04cc213.
(maint) Handle different ssh service names in `puppet resource service` test

This test was using a regex to match the output for the ssh/sshd service
from puppet resource, but was explicitly invoking the command with the
name ssh. Since we can check the state of that service from the list of
all instances (in which case the regex is actually beneficial), there's
no need to look at the specific service separately. This combines the
two steps, and makes the test more robust to different names for the ssh
service.
fix caching of "false" settings
Merge branch 'nicklewis-fix-puppet-resource-service-test' into stable

* nicklewis-fix-puppet-resource-service-test:
  (maint) Handle different ssh service names in `puppet resource service` test
  Revert "Revert "Merge branch 'nicklewis-rcS-is-a-jerk' into stable""
Merge branch 'stable'

* stable:
  (maint) Handle different ssh service names in `puppet resource service` test
  Revert "Revert "Merge branch 'nicklewis-rcS-is-a-jerk' into stable""

closes #1620
Add DRY support for boolean parameters

Boolean parameters are common and used several places in the codebase,
as well as in user code.  Without this change, each parameter requires a
description of true and false values, and code to recognize those
values.  That is implemented slightly differently from place to place,
leading to inconsistent behavior for users.  And anyway, it's all WET.

Instead, this concentrates the implementation in one place.  This is
easier for users (a consistent set of true/false values) and developers
(less boilerplate and easy resulting values -- Ruby's true and false,
not :true or "true" or anythign like that).
(maint) Fix ENC acceptance test failure on 1.9.3

Without this patch the `node_overrides_topscope_when_using_enc`
acceptance test is failing when run on MRI 1.9.3 and is passing when run
on MRI 1.8.  This is a problem because Puppet 3 fully supports MRI 1.9
and we need the tests to pass.

The root cause of the problem is an incorrect YAML input file when
providing data to the ENC api.  Without this patch the YAML uses a hash
value that is a string.  In MRI 1.8 String#each iterates over each
character.  The string passed is a single character, "a" so the behavior
in 1.8 has the desired effect by accident.

In MRI 1.9 there is no String#each method so the test fails.  This patch
addresses the problem by changing the YAML to be the correct input of a
hash value that is an Array.

Paired-with: Henrik Lindberg <henrik.lindberg@cloudsmith.com>
Merge branch 'stable_precise' into stable

* stable_precise:
  (maint) Fix ENC acceptance test failure on 1.9.3

closes #1623
Merge branch 'stable'

* stable:
  (maint) Fix ENC acceptance test failure on 1.9.3
(maint) Fix install module acceptance test on precise

Without this patch the `with_modulepath.rb` acceptance test is failing
on Ubuntu 12.04.  The cause of this problem is that `puppet apply` is
being used to purge the `/etc/puppet/modules2` directory, which doesn't
appear to be working as expected.  This itself is concerning, but the
concern is unrelated to the expected behavior expressed in the test.

This patch addresses the problem by simply using `rm -rf` to purge the
acceptance test instead of using `puppet apply`.
(#7224) Fix hostname does not match on Ubuntu 12.04

Without this patch Puppet does not improve upon the `hostname does not
match the server certificate` error message coming from OpenSSL.  The
root cause of this problem is a bad regular expression that matches on
`error.message =~ /hostname (was )?not match/` when the error message on
precise is actually `"hostname does not match the server certificate"`

This patch addresses the problem by allowing any word to optionally
exist between `hostname` and `not` in the error message.
(maint) Improve failure message
(maint) Fix enc_provides_node_when_storeconfigs_enabled on precise

Without this patch the enc_provides_node_when_storeconfigs_enabled is
failing on Ubuntu 12.04 LTS with MRI 1.9.3-p0.  The root cause of the
failure is that the ENC script used does not output valid YAML data,
it's lacking the `--- ` header.

This patch addresses the problem by using `Hash#to_yaml` to produce
valid YAML output for the ENC API.
Merge branch 'stable_precise_acceptance' into stable

* stable_precise_acceptance:
  (maint) Fix enc_provides_node_when_storeconfigs_enabled on precise
  (maint) Improve failure message
  (#7224) Fix hostname does not match on Ubuntu 12.04
  (maint) Fix install module acceptance test on precise

closes #1624
Merge branch 'stable'

* stable:
  (maint) Fix enc_provides_node_when_storeconfigs_enabled on precise
  (maint) Improve failure message
  (#7224) Fix hostname does not match on Ubuntu 12.04
  (maint) Fix install module acceptance test on precise
Revert "Merge branch 'nicklewis-fix-puppet-resource-service-test' into stable"

This reverts commit f81c157f23ee637781c7bb1e384c7cb6395bcb27, reversing
changes made to 38d085c697a530192b02c2badcc4e9a73813e62d.

This change set is being reverted a second time because the acceptance
test is failing on Solaris 10 which has very different service names.

I'm reverting it because the failure represents work in progress that is
interrupting other work, even though it is a small regexp.  Based on
discussion, we might simply need to open the regexp up to:

    [10:21 AM] Nick Lewis: @jmccune /.*ssh.*/ perhaps, but that's getting a
    little silly.
(#20447) Wait for server to shutdown before exiting daemon

Previously, if the filetimeout was set to 0 and the puppet master was
run, the master would exit immediately. This was caused by the scheduler
having nothing to do and the new logic for it causes it to stop running
at that point (because once there is nothing to do, there is also no
chance that something will cause it to having something to do). There
was a slightly wrong assumption that was being made for that logic: the
scheduler is in control of all activity in the daemonized process. This
is not the case.

The daemon has 3 parts to it:
  * configuration reparse
  * agent runs
  * server control

The server does not take part in the scheduler inside the daemon. It is
assumed to be a separate thread/process, which the daemon will kick off
when it starts, and stop when the daemon is told to stop. When the
"start" method of the daemon exits, the daemon itself exits and the
server will be required to shut down.

There are 2 ways that could be used to solve this problem: have the
scheduler sit in a busy loop (or sleep forever) when it has nothing to
do, or wait for the server to finish before the daemon considers itself
done. This commit uses the latter option.

The new code will wait for the server to finish before the Daemon#start
method returns. This makes the dependency explicit rather than hidden in
an infinite loop in the scheduler.
(#20383) Provide location of duplicate resource in error

Commit ac83f85 cleaned up Puppet::Error and extracted file and line
presentation into a mixin. However the DuplicateResourceError exception
was relying on that behavior, and when the behavior was extracted the
location of the duplicate resource was lost.

This commit mixes in the ExternalFileError mixin and passes the file
line and number to the exception so that the duplicate resource location
can be displayed.

Thanks to Richard Clamp <richardc@unixbeard.net> for finding the
original error and providing the base for this fix.
Merge branch 'stable'

* stable:
  Revert "Merge branch 'nicklewis-fix-puppet-resource-service-test' into stable"
Merge branch '20383-duplicate_resource_error_location'

This supersedes GH-1619