Ensure factsets endpoint unescapes any delimiters

The delimiter #~ is reserved so we escape it on storage. Previously we had not
been removing the escaping from this field before returning it to the user,
this patch remedies that.

Signed-off-by: Ken Barber <ken@bob.sh>
(maint) Split out acceptance and unit test gems in a better way

We want to avoid installing all of the unit test gems when running acceptance.
This patch moves rake into its own place so we can use --without test properly.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1026 from kbarber/maint/master/fixup-gemfile-for-acceptance

(maint) Split out acceptance and unit test gems in a better way
Merge pull request #1024 from kbarber/maint/master/unescape-delimiter

Ensure factsets endpoint unescapes any delimiters
(maint) Switch confine for basic test during acc dependency installation

The way we were using confine was wrong, and since this is now more strict
in beaker it was throwing errors in the master smoke tests. This patch
just replaces it for a basic include? on the master platform instead.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1027 from kbarber/maint/master/fix-acceptance-confine-logic

(maint) Switch confine for basic test during acc dependency installation
(PDB-709) Fact nodes endpoint

This patch introduces the new structured facts capable fact-nodes endpoint.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1028 from kbarber/ticket/master/pdb-709-new-fact-path-value-querying

(PDB-709) Fact nodes endpoint
(maint) Fix an intermittent testing failure with time for factsets

Our test data population code was still using its own version of time, instead
of using the one passed as an argument. This made the matchers fail in a racey
way.

Signed-off-by: Ken Barber <ken@bob.sh>
(PDB-746) Add capability to use globs when querying fact-nodes

This adds the new operator *> which is a path glob operator that only works
against the `path` type. It works by internally converting the array of
literals and potential globs into a single regular expression for querying
the fact paths.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1029 from kbarber/ticket/master/pdb-746-fact-nodes-globbing-path-query

(PDB-746) Add capability to use globs when querying fact-nodes
Merge pull request #1030 from kbarber/maint/master/intermittent-testing-failure

(maint) Fix an intermittent testing failure with time for factsets
(maint) Fix fact-node globbing tests

The regular expression I provided for the glob replace wasn't sufficient for
PostgreSQL to work. This patch amends it to be so.

I've also put in a test for keys with blank strings, to make sure this change
doesn't affect that case as well.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1032 from kbarber/maint/master/fix-globbing-tests

(maint) Fix fact-node globbing tests
(PDB-763) Provide trgm index handling for fact_paths

This patch adds a detection routine outside of the normal migration that will
nag the user if they don't have pg_trgm installed (or don't have a compatible
system for trgm and regexp performance, ie. pg 9.3 or above).

If trgm is working, it will manage installing the correct index on the
fact_paths table for regular expression query optimization.

Without a trgm index, globbing and regular expression queries will not use
an index and thus those queries become full table scans.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #1033 from kbarber/ticket/master/pdb-763-trgm-indexing

(PDB-763) Provide trgm index handling for fact_paths
(PDB-772) Modify the facts endpoint to return structured facts

This pull request causes the v4 facts endpoint to return typed and structured
facts while leaving the v3 responses stringified as before.  It also adds a
"name" column to the fact_paths table representing the first element of a
fact's path.  This column should be renamed to "fact" in the future to avoid
confusion with the many references to 'certname' as name.
Merge pull request #1031 from wkalt/ticket/master/pdb-772-change-facts

(PDB-772) Modify the facts endpoint to return structured facts
(maint) maint/master/fix facts environment ordering

this fixes an issue with ordering by environment on the facts endpoint and
patches the corresponding blind spot in our tests.
Merge pull request #1035 from wkalt/maint/master/facts-environment-paging

(maint) fix order on environments for facts