(PE-962) Add schema for flagging latest report per node

This commit adds a new table for storing data about which
report was the most recent for each node.  This will make
it easier to write event queries that only return events
from the last puppet run for each node.

The migration code also has to populate this new table for
all of the existing data.  The commit includes tests
to validate that migration code.
(PE-962) Update latest report for node when storing reports

Prior to this commit, we had the new schema and migration
code for flagging the latest report for each node, but
we weren't updating that data when new reports came in.

This commit adds the code to do those updates every time
a new report is stored, and tests to verify that this
behavior works as expected.
(PE-962) Clean up SQL for initial `latest_reports` population
(PE-962) remove unnecessary extra index on primary key

Because the `node` column of the new `latest_reports` table is already marked as the `PRIMARY KEY`, we don't need to explicitly create an index on it.
(#22122) Fix ssl-setup error when no puppet certs exist

In the case where puppetdb-ssl-setup is ran without certificates pre-existing
the script current just returns an unhelpful error.

This was bad, as this often occurs during package installation, leaving the
user with a feeling that the package installation is now broken.

This patch means the tool now returns a meaningful error, and tries to advise
the user as to what to do next.

I've added coverage specially for this case as well.

Signed-off-by: Ken Barber <ken@bob.sh>
(PE-1205) Add support for querying reports by hash

Prior to this commit, we only supported querying for reports
by the certname of the node that the report was received from.
This commit adds support for querying by the report hash,
which can be retrieved from events via the events query
endpoint.
Merge pull request #603 from kbarber/ticket/1.4.x/22122-ssl-setup-unhelpful-error-with-no-certs

Ticket/1.4.x/22122 ssl setup unhelpful error with no certs
Fix missing paren in doc
(PE-1300) Don't ignore failed resource statuses

Prior to this commit, the PuppetDB report processor/terminus
ignored 'failed' resource statuses unless they have events.
This commit changes the processor so it no longer ignores them
and instead it fabricates an appropriate event to attach to
the 'failed' resource status.

Ideally, Puppet should be including resource events even for
'failed' statuses, but until then, and to support backwards
compatibility, we can just fabricate the events.
(Bug #22240) Remove EoL Fedora 17

Since Fedora 17 is now officially End of Life, we're removing it from
our mocks
Merge pull request #595 from cprice404/feature/burgundy/PE-962-save-last-run-info

Feature/burgundy/pe 962 save last run info
Merge pull request #616 from melissaanne/maint/1.3.x/rm-eol-f17

(Bug #22240) Remove EoL Fedora 17
Add comment relating code to ticket
Merge pull request #613 from cprice404/feature/burgundy/PE-1205_query_for_report_by_hash

Feature/burgundy/pe 1205 query for report by hash
Query compilation should happen within a db transaction

In order to successfully compile equality predicates, we need to know
exactly which database the user is talking to (PG8, PG9, HSQLDB). That
lets us figure out if we can use a fast-path (for array queries).
Merge pull request #620 from grimradical/fix-broken-acceptance-tests

Query compilation should happen within a db transaction
(#22159) Fix anonymization for catalog edges

This patch ensures the context for edges is correct, without it edges always
get anonymized breaking exports when using the moderate profile.

This patch also consolidates the tests for full & none profiles, adding tests
for moderate also.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #622 from kbarber/ticket/1.4.x/22159-fix-edges-for-anon

(#22159) Fix anonymization for catalog edges
Merge pull request #615 from shakedown/pe1300-submit-failed-events

(PE-1300) Don't ignore failed resource statuses
(PE-1304) Add configuration-version to events response

Prior to this commit, the response from the events endpoint
did not contain the configuration version. This commit adds
that field, which was already present in the database.