Port node query compiler to the resource form

This makes the code much more similar for the two types of queries, and
probably also much faster for complex queries. Right now that means a
lot of duplication, but hopefully it will allow for future unification
into a single query API.
Properly handle non-string node queries

Previously, these would result in 500 errors as the database failed the
comparisons because of mismatched types. Now, all equality comparisons
will be done against strings, and all numeric comparisons will be done
against numbers.

For equality comparisons, non-string arguments will be converted. This
allows natural queries against numbers or booleans to work despite all
fact values technically being strings.

For numeric comparisons, non-numeric arguments will be converted.
However, if the argument doesn't represent a number, the query will
be rejected.
Merge pull request #207 from KushalP/master

Simplify function usage
(#15075) Improve handling of service start/stop during rpm upgrade/uninstall

Prior to this commit there were a few issues with the way we were
handling interacting with the system's puppetdb service during
rpm upgrade and downgrade.  Basically, we were *always* stopping
(and disabling) the service whenever an uninstall occurred; however,
during an upgrade, rpm does an install of the new package followed
by an uninstall of the old package.  We weren't treating this
situation differently, so the service was being stopped.  This
commit does the following:

* On uninstall, we now check to see if this is part of an upgrade
  or not, and we only stop and disable the service if this is
  *not* part of an upgrade.

* On upgrade, we stop the service before we install the new package,
  and restart it after we finish removing the old package.
(#15446) Improve handling of user/group removal on rpm removal

Prior to this commit, we had a few bugs in our handling of
user/group removal during rpm removal:

1. We were not conditioning the calls to groupdel / userdel to
   avoid running them during an upgrade, which meant that we
   were trying to delete them even during upgrades... which would
   have been bad.
2. We had an || where we needed an &&, so we weren't actually
   calling the groupdel / userdel commands.
3. We were hard-coding the user's home dir to a bad path.
4. We had some '-r' flags that were wrong and/or unnecessary.

This commit fixes those issues.
(#15075) State cleanup at the beginning of rpm 'pre' step

This commit just adds a bit of pre-emptive state cleanup
at the beginning of the rpm 'pre' step, to protect against
possible bad behavior if there were any problems during
previous installs / uninstalls.
Merge pull request #208 from cprice-puppet/bug/master/15075-rpm-update-stops-service

(#15075) Improve handling of service start/stop during rpm upgrade/unins...
Improve pre/postconditions for node query
Remove unnecessary, commented tests for node query compiler

These were commented because they test the SQL generated by the
compiler, which is unnecessary and prone to breakage. This is already
tested end-to-end by issuing actual queries.
Merge pull request #202 from nicklewis/rewrite-node-query-compiler

Rewrite node query compiler
Merge pull request #209 from cprice-puppet/bug/master/15446-rpm-does-not-remove-user

(#15446) Improve handling of user/group removal on rpm removal
Verify config path before starting up

Prior to this commit, if the config path that the user
specified did not exist or was not readable, we'd silently
ignore it and then fail a bit later with a confusing
error message about not finding a "vardir" setting.

This commit adds a bit of explicit checking to make
sure that the specified config path exists and is
readable before we try to parse the ini file(s).
Fix an incorrect username in the puppetdb-ssl-setup script

Somehow we recently ended up with an invalid username in
the puppetdb-ssl-setup script; it was set to "pe-puppet" when
it should have been set to "puppetdb".
Merge pull request #211 from cprice-puppet/bug/master/wrong-username-in-ssl-setup

Fix an incorrect username in the puppetdb-ssl-setup script
Merge pull request #210 from cprice-puppet/refactor/master/verify-config-path

Verify config path before starting up
(#14688) Improve stdout/stderr handling for redhat init script

Prior to this commit, the redhat init script was keeping stdout/stderr
opening when you called "service puppetdb stop".  This resulted
in some undesirable behavior; starting the service over an ssh
connection would not release the ssh connection, errors would
appear on the console rather than in the log file, etc.

This commit simply changes the init script to call "daemon" and
to redirect stdout/stderr to a file.  In local testing, this
appears to solve both of the reported problems (ssh hangs and console
errors).
Work around non-string resource titles

It's possible in some cases for Puppet to generate a resource whose
title isn't a string. However, since the generated edges refer to the
resource using a string title, we end up with a mismatch. Now we will
stringify all resource titles on the way out. In future, Puppet should
do this for us.
Cosmetic fixes to parse-config method
Merge pull request #212 from nicklewis/non-string-resource-titles

Work around non-string resource titles
Stop recursive symlinks from `rake install`

We were using `ln -sf`, which will symlink a directory into itself when
the source is a directory and the destination is already a symlink to
the source. This is what happens when `rake install` is run twice. Now
we use `ln -sfT`, which treats the destination as a regular file, and
won't traverse it when considering where/whether to make the symlink.