(PUP-1151) Respond with 404 when path not known

The v2.0 api implementation had a type that was not caught by any tests.
This fixes that issue (a typo) and adds a test that would have shown the
problem.
(PUP-1387) fixes wrong hash in subjectKeyIdentifier

this fixes the regression that appeared when the arguments to
ExtensionFactory where accidentally swapped.
Also added a test case to check if the subjectKeyIdentifier is present.
(maint) expand ExtensionFactory creation for clarity

The code compression in 94345ebac introduced a regression where the
issuer certificate and subject certificate were transposed, which would
cause erroneous extensions to be created. db5fb8a fixed this issue but
it's still pretty unclear why the given values are set. This commit
removes the code compression so that we specifically call out the
behavior of adding extensions to a self signed cert.
(doc) Document certificate_factory methods

Any code dealing with X509 is rather difficult to understand by default,
and methods that have no documentation don't help. This commit expands
method documentation for future generations that are brave enough to
delve into this code.
Merge branch 'pull-2237'
(PUP-1118) Ensure there is only one *root*

If there are multiple root environments ever created, then functions
that belong on the root do not get registered correctly. This stops that
by making sure that the root is only created during the bootstrap phase.
Merge pull request #2297 from zaphod42/issue/master/pup-1151-error-when-generating-404-response

(PUP-1151) Respond with 404 when path not known
Merge pull request #2296 from zaphod42/feature/master/pup-1118-implement-environment-directory

(PUP-1118) List environments from a directory
(PUP-1278) Windows Puppet Agent Service gracefully terminates after succesfully being put into a Paused state

Removed redundant return statement
Added in logic to only start the Puppet Agent if the service is in a Running or Idle state
Merge branch 'pull-2137'
(PUP-1318) Make service squelch false
This will allow us to get failure output from commands...
(PUP-1318) Service now outputs full errorlog on fail
(PUP-1318) Fixing expected parameters in service provider specs now that service output is no longer squelched by default.
Redmine 565, a seven year old issue referenced in a comment in lib/puppet/provider/service/service.rb, is no longer applicable to `Puppet::Util::Execution#execute`.  It was squelching service output because of a bug in ruby where `#read` on a pipe never returned when the spawned process is SIGTERM'd by one of its children.  The current implementation of `Puppet::Util::Execution#execute` redirects to a temporary file instead of reading from a pipe.
We should no longer be squelching service output so that users can easily diagnose service failures.
(PUP-1485) Don't use master when we want compilation to fail

Previously, this test assumed that outside of a with_puppet_running_on
block, the puppet master would not be running. This is true in the
FOSS test environment, but when we test against PE there is always a
master running. By using a name that is guaranteed to not be a puppet
server, we can ensure the agent is always incapable of getting a
catalog.
Merge branch 'maint/stable/acceptance-dont-make-foss-assumptions' into stable

* maint/stable/acceptance-dont-make-foss-assumptions:
  (PUP-1485) Don't use master when we want compilation to fail
Merge branch 'stable'

* stable:
  (PUP-1485) Don't use master when we want compilation to fail
Merge pull request #2302 from peterhuene/fix/pup1318

(PUP-1318) Stop squelching service output so that it's easier to diagnose service failures.
Merge pull request #2295 from kylog/issue/external-facts-dir-api

(pup-1505) Switch to using facter.search_external for setting search pat...
PUP-1494 Guard against Win32 memory corruption

 - Ruby's .encode(UTF-16LE) call on String may generate a string that
   not properly terminated with 2 NULLs, which may result in garbage
   bytes read from the memory pointer passed into the Win32 API. This
   can cause memory instability which results in failures in later
   Win32 calls.  These calls have been replaced with an internal
   helper that properly NULl terminates the string.  Note that this
   bug is fixed in Ruby 2.1:
   http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=41920&view=revision
 - Don't include the wide NULL character when calculating number of
   characters to write to the console to properly indent Puppets stdout
   output (without the -1 calculation, it's indented with two spaces).
 - Includes a test to ensure that we can detect when `string_encode` is
   updated in the future, when we move to a version of Ruby where the
   String#encode bug is fixed for encodings with multi-byte terminators

Paired-with Josh Cooper <josh@puppetlabs.com>
(maint) Don't duplicate hash keys in rspec tests

RSpec examples can be restricted by using `:if`: and `:unless` values in
the example metadata. However these are hash keys, and defining two
`:if` statements will cause the latter definition to overwrite the
first. This commit resolves this issue by defining a single expression
evaluated by `:if` instead of having two separate clauses.