Add positional types to Razor::Matcher#validate

This extends Razor::Matcher#validate to accept different argument types for
different argument positions. This will allow the `fact` operator to take in a
String for the fact name followed by a mixed type second argument that would
serve as the 'fact-not-found' default return value.
Define failure semantics for `fact` operator

Defining `fact` to match or raise an error prevents matching failures because
of typos or incorrectly named facts. Allowing a second, default argument for
the `facts` operator prevents "special-case" facts -- facts for specific nodes
that aren't usually defined -- from causing rampant error-raising. The result
helps defend against human error while providing an easily-accessible override.
Refuse to bind nodes if any tag raises an error

To prevent accidental binding of nodes to policies due to typos, no node is
permitted to bind to a policy if a tag raises an error during evaluation.
To aid in troubleshooting, the node appends an error message to its log with
details of the failure.
Add num, gte, gt, lte, lt matcher operators

This adds standard numeric greater-than, less-than, and their respective
-or-equal operators to the tag matchers. Since these currently support only
numeric values, a `num` operator is also provided, which attempts to convert
its argument into a numeric equivalent. While the gt, lt, etc. operators are
useful of themselves, `num` is provided as a continuation of the 'explicit
rather than implicit' pattern.

`num` supports binary, octal, decimal, and hexadecimal integers, and floating-
point numbers in decimal or scientific notation. All values can be passed as
strings or as literal numeric values. Any other values will cause a
Razor::Matcher::RuleEvaluationError to be raised.
Whitespace changes

Just formatting to make stuff look nicer
* lib/razor/messaging/sequel.rb: add missing require's of razor environment
Implement `broker_paths` in the config object

This roughly mirrors the `installer_paths` feature, but has better testing and
edge case behaviour implemented.  Also includes extra bonus testing.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Lift common behaviour around path handling in config object

The installer and broker paths share similar behaviours; this lifts the
commonality into a single function and invokes it from both.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement the "broker" abstraction for filesystem broker content

This adds a Razor::Broker class that wraps the filesystem based broker
content: configuration data, installation scripts and templates, and other
parts of the on-disk component are managed from this class.

This is not the "broker" referenced from a policy; that is an "instantiation"
of these brokers into the database -- still to be written -- that turns the
configuration data into a record of the chosen configuration, and otherwise
ties in with the rest of the running configuration.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement the database side "broker" entity

This reflects the instantiated version of the broker: when a user creates an
instance of the broker from the on-disk representation, they do so by giving a
name to the instance, and setting configuration parameters.

This stores the parameters, and the relationship with the on-disk object, to
allow the system to be aware of the users desired relationship.

This is not yet usable, only the container to ultimately hold the data.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Expose broker configuration values to the node install script template

This ties together the "instance" of the broker from the database, and the
representation of the in-memory broker, to be able to produce an
installation script.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Provide a shortcut from the broker instance to the installer script

This provides a shortcut for the most common operation: given this node, and
this broker instance, give me the installation script to run on the node.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Import `fabrication` gem for building database objects

This replaces the hand-coded object creation code in spec_helper with
Fabricator helpers.  These quickly build database objects to spec, making it
easier to get the data we need.

The primary advantage is that Fabrication provides native support for, eg,
sequences, creating multiple objects, and distinct classes of objects
being created.

This replaces the hand-coded version that was growing steadily in complexity
toward the same capabilities.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Bind brokers to policies

This adds a broker relationship to the policy table, and enforces that every
policy has a broker to ultimately hand off control to.  This mirrors the
current Razor behaviour.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement `create_broker` command

This adds the `create_broker` command, which creates an appropriate instance
of the broker based on the on-disk configuration.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement validation of configuration schema for brokers

This updates the broker code to finally implement validation of the
`configuration` data the user supplies.  That is now checked against the
schema supplied by the on-disk broker, and in the case of an error the
instance is treated as invalid.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement broker query API, collections and details

This implements the broker collection API, and provides access to the
currently defined set of brokers.  This includes validation that the returned
JSON conforms to our expectations.

It also implements, and similarly verifies, the individual item details pages
work as expected and are correctly linked together.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add a gem-based `puppet` broker, to mirror older Razor

This adds a gem-based puppet broker to Razor, mirroring the behaviour of older
versions of Razor.  This should have roughly the same result when used to
install a node.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
fixup! Implement  in the config object