(PDB-663) Convert PuppetDB to Ezbake build system

This significant patch introduces Ezbake to PuppetDB, providing all the
required changes and some cleanups as well to make this possible:

* Of note, the old system is still around, until we work out how to do source
  based installations of PuppetDB in this new world. This will be done as
  another piece of work separately.
* CONTRIBUTING.md has been updated to the latest version from Puppet
* ERRATA.md has been removed, we have a ticket tracker
* Some changes we did on the old system:
 * Dependencies on latest Puppet & Facter have been changed in older system
 * Pathing updated to reflect closer to ezbake
* Debian 6 & Ubuntu 10.04 have been retired. We made this decision due to the
  reluctance to transfer the java lookup code in /etc/default/puppetdb into
  ezbake. Since this code is required to support Oracle JDK installation of
  Java 7, retirement was inevitable. Since these versions of the distros are
  nearly end of life anyway, we gave our users a stepping stone, by providing
  this in the first place, we feel this was an okay move.
* All beaker tests have been modified to work in an ezbake world.
* We've decided to use the nrepl trapperkeeper service now, to avoid conflicts
  and to finally shed that old code. We have updated the code and documentation
  to reflect this, and we provide a warning if users use the old [repl] block.
  Instead users must define the [nrepl] block, and it is no longer possible to
  choose a `type` of repl service.
* The package `puppetdb-terminus` is now called `puppetdb-terminii` and we've
  changed the references in code and docs to use this now. A module change will
  be required at some point, but this work is separate.
* Beaker tests are now in a script shipped with the project for Jenkins to use.
* Binaries are now installed in /usr/bin instead of /usr/sbin as per the ezbake
  standards.
* Lots of template files were transferred into resource/ext, this is what ezbake
  expects.
* Documentation has moved inside /usr/share/puppetdb/docs to a new location
  depending on the distribution. This is to follow the ezbake standards.
* project.clj was updated to make ezbake work, and to fix some warnings from lein
  deploy.
* A lot of softlinks were removed from /usr/share/puppetdb, that were pointing
  at the /var/lib/puppetdb & /etc/puppetdb/ spaces, I believe this was a partially
  completed migration from the past. The module for example had to be updated, so
  only the puppetdb module 4.1.0 will even work once we ship this.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1158 from kbarber/pdb-663-ezbake

WIP: (PDB-663) Convert PuppetDB to Ezbake build system
(PUP-3512) Use new Profiler API

Change the `profile` function in PuppetDB to use the new Puppet
Profiler API in preparation for removing the old API from Puppet.
Modify all calls to the `profile` function in PuppetDB to pass in
a metric ID.
Merge pull request #1157 from fpringvaldsen/PUP-3512-new-profiler-api

(PUP-3512) Use new Profiler API
(PDB-1029) Provide an arity detection for backwards compatibility for profiling

This patch fixes the arity problem on the oldest version of Puppet we support
by adding a compatibility layer that uses the correct argument list based
on the methods arity available.

Signed-off-by: Ken Barber <ken@bob.sh>
(PDB-1017) Fix node tests hiding failures

There were several tests that were failing in v4 that were being hidden
by skipping over the assertions when the resulset was nil/empty. This
commit adds an explicit result count check and fixes the tests that were broken.
Merge pull request #1161 from senior/ticket/master/pdb-1017-node-tests-broken

(PDB-1017) Fix node tests hiding failures
Merge pull request #1160 from kbarber/ticket/stable/pdb-1029-fix-profile-compat

(PDB-1029) Provide an arity detection for backwards compatibility for profiling
PuppetDB: broken links in connect_puppet_master

Fixed /api/query/v3/events.html
and /api/query/v3/events.html
PuppetDB: broken links in connect_puppet_master

Fixed /api/query/v3/events.html
and /api/query/v3/events.html
(docs) Using an extract is now possible at the top-level

So we now allow an extract at the top level, this patches the documentation to remove the
strict statement about this not being allowed. The docs for the subquery elements still make
sense.
Merge branch 'stable'

* stable:
  PuppetDB: broken links in connect_puppet_master
  (PDB-1017) Fix node tests hiding failures
  (PDB-1029) Provide an arity detection for backwards compatibility for profiling
  (PUP-3512) Use new Profiler API

Conflicts:
	puppet/lib/puppet/indirector/facts/puppetdb.rb
	puppet/lib/puppet/indirector/resource/puppetdb.rb
	puppet/lib/puppet/util/puppetdb/command.rb
	src/puppetlabs/puppetdb/query_eng/engine.clj
	test/puppetlabs/puppetdb/http/nodes_test.clj
(maint) Repair tests from last merge-up

I missed a couple of failing tests last merge-up, this fixes that issue.

Signed-off-by: Ken Barber <ken@bob.sh>
(PDB-1038) Include a new namespace for ezbake to use for service startup

This provides a new namespace: puppetlabs.puppetdb.main that will be used to
startup the PuppetDB service. This avoids the need to include the sub-command
'services' in the ezbake configuration templates, avoiding the need for
a new parameter to be added to ezbake to support this 1 edge case.

The new namespace contains a single function -main, that effectively wraps
the sub-command 'services'.

We also noticed that the core.clj file had a gen-class declaration, since
we don't use AOT this is not needed and is being removed.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1167 from kbarber/pdb-1038-ezbake-entrypoint

(PDB-1038) Include a new namespace for ezbake to use for service startup
Ensure we use our own vendored directory for gems

We were using the global gemset which is a bad thing, this patch fixes that.

This was causing issues when a fog-core gem that was bad had been permanently
'cached' due to the use of a global gemset. This will slow the build down
and create another potential place of failure, but it is more correct.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1168 from kbarber/maint/master/tests-use-vendor-path-for-gems

Ensure we use our own vendored directory for gems
(PDB-722) Added validation for in/extract fields in that are passed in vector form. Covered with tests.
Merge pull request #1165 from DemonShi/pdb-722

(PDB-722) Added missing validation for fields in vector forms for 'in' and 'extract' operators in API v4