Add a `puppet storeconfigs export` command to dump the database

This command can be used to export a copy of the ActiveRecord
storeconfigs database (only exported resources, and only nodes with
exported resources) which can be imported into PuppetDB.  This is useful
when migrating from old-school storeconfigs to PuppetDB, as it allows
agents to run without losing any of their exported resources for a time.
Once every agent has run once, the database should be up-to-date in any
case.
Don't export catalog environment

This isn't actually a legal key on the catalog, so exclude it.
Write the storeconfigs database dump as a .tar.gz

Previously this was a single file containing many JSON objects, for the
catalogs. Now it's a .tar.gz (or .tar if gzip can't be found [or
directory if tar can't be found]) containing one file per node. The
tarball also includes a metadata file specifying the nodes which are
present, the timestamp of the export, and the version of the "replace
catalog" command which ought to be used to submit the catalogs to
PuppetDB.
Add a pending acceptance test for storeconfigs export

This test can't be finished until the import functionality for PuppetDB
proper is complete, but it seems better to have this start than nothing.
Conform to the PuppetDB export format
Document the `puppet storeconfigs export` command

This also forms the beginnings of a migration guide.
Merge pull request #438 from nicklewis/storeconfigs-migration

Add a `puppet storeconfigs export` command to dump the database
Fix SO MANY Ruby 1.8.7 issues in storeconfigs spec

When reading our export tarball back and mapping it to a hash, we were
trying to omit directories, which are indicated by a trailing slash.
Unfortunately, on Ruby 1.8.7, indexing into a string returns the integer
value of the character at that position. So we need to use
filename[-1,1] to tell Ruby to get a 1-character long substring instead.

Also, we had been reusing the variable (filename) containing the
location of our tarball as a block variable. In Ruby 1.8, this clobbers
the original variable outside the block, which caused us to be unable to
read the tarball later.

Finally, we were retrieving the content of the tarball using
String#lines. This returns an Enumerator, which for some reason in Ruby
1.8.7 won't implicitly convert to an array when passed as an argument to
zip, so we have to do it manually.
Merge pull request #450 from kbarber/ticket/master/tb-driver-deprecation

Define postgres settings using environment vars
Properly package new Ruby files

These were being inadvertently left out of packaging, which naturally
caused it to fail.
Merge pull request #451 from nicklewis/package-storeconfigs-code

Properly package new Ruby files
(#17842) Return meaningful errors with invalid resource references

Normally this kind of thing isn't allowed:

    file { '/tmp/foo':
      ensure => present,
      require => Mymodule::foo['bar'],
    }

However puppet lets it slip by when someone uses create resources:

    create_resources('file', { '/usr/local/homeaway/api-favorites-ustst1-jdk/java' => { ensure => present, require => "Mymodule::foo[bar]" }})

With the puppetdb terminus, our relationship checks fail when this kind of
delcaration is used, however in the compiler terminus it slips through because
I believe the comparison is done all in capitals.

Since the parser stops it, it shouldn't be allowed. However, our behaviour is
confusing to the user. This patch adds a more meaningful error message to this
kind of failure, instead of stating that it is a relationship error we stop
earlier with an error about the format.

Signed-off-by: Ken Barber <ken@bob.sh>
Raise Puppet::Error consistently in catalog indirector

Previously we were just raise exceptions with no specific exception, this patch
makes the behaviour consistent across the file. Tests updated also.

Signed-off-by: Ken Barber <ken@bob.sh>