Allow `conform!` in commands

In order to change the client=>server API, there needs to be some backwards-compatibility in effect. This `conform!` capability will allow a command to decide which data mutations it can perform on its data before running its validation.
Fixing invalid JSON returned on some errors

Invalid JSON was being returned whenever certain errors (TypeError, ArgumentError, etc.) were raised.
Add `element` and `references` to array validation

In order to facilitate some shorthand syntax (`["abc"] => [ {"name": "abc"} ]`), arrays will need to hold datatypes besides just objects and also assure relational integrity. The type `element` (aliased as `elements`) will be used to denote a basic datatype in an array. `references` will work like it does for hash. This includes a change to hash attribute default behavior, where now if no reference name is provided, it defaults to 'name', rather than the property's name. This was done to establish a clearer convention.

Part of this change is also moving incorrectly located tests for array attributes, which were previously in the array schema spec file.
Allow shorthand in `create-policy` command

Create Policy is a representative example of the shorthand involved. This converts create-policy attributes `repo`, `task`, `broker`, and `tags` to no longer need an object/hash with just the "name" property defined. In order to preserve backward-compatibility, this command now overrides `conform!`. The method upgrades commands written in the old syntax to the new syntax.

There was a previous regression where create-policy would not create tags that specified a `rule` array. This has been added back.
Shorthand references in other commands

`create-repo` and `move-policy` need the same updates for references from just a string rather than the string in an object's `name` property.

This was a good opportunity to fix up and refine the spec tests for both commands.

Fixes https://tickets.puppetlabs.com/browse/RAZOR-192
Allow marking newly discovered nodes as 'installed'

This adds a configuration option, `protect_new_nodes`, which if set to a true
value causes all newly discovered nodes to be marked installed at the exact
same moment.

This will result in the default behaviour of Razor changing from "install
based on policy" to "install based on policy once a node reinstall is
explicitly requested", a much safer default for users.

By default Razor will continue to assume that it controls everything on your
network, and treat any newly discovered node as a candidate for immediate
installation according to policy.

https://tickets.puppetlabs.com/browse/RAZOR-152

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Automatically type-check array and object entities in validation

When an `object` or `array` helper is used for an attribute, we already know
what type the entity is -- so we can automatically set that check in the
attribute code.

This allows things like `size` checks to be applied more naturally to
`object` or `array` attributes, too, without having to manually add the
`type` check.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Automatically maintain `installed_at` field of nodes

Previously every location in the code that set the `installed` field on a node
also hand-maintained the `installed_at` field.  This replaces that with an
extension to the setter that automatically updates the value, codifying this
behaviour for all external callers.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add `register-node` command to pre-register nodes with Razor

In order to make brownfield deployments of Razor easier we allow users to
register nodes explicitly.  This command allows you to perform the same
registration that would happen when a new node checked in, ahead of time.

In order for this to be effective the hw_info must contain enough information
that the node can successfully be matched during the iPXE boot phase.

If the node matches an existing node, in keeping with the overall policy
of commands declaring desired state, the node installed field will be
updated to match the value in this command.

The final state is that a node with the supplied hardware information,
and the desired installed state, will be present in the database,
regardless of it existing before hand or not.

https://tickets.puppetlabs.com/browse/RAZOR-151

Signed-off-by: Daniel Pittman <daniel@rimspace.net>