Set the ESXi node hostname during first boot

This adds the necessary configuration to set the hostname during first boot
when installing ESXi.  This was omitted incorrectly in the first version of
the installer; thanks to Mohammad Dhedhi <mohammad_dhedhi@dell.com> for
the pointer.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add IPMI data to the node definition in our database

This is presently hard-coded into the node, and tracks the three critical
details for communicating with the BMC: which host, user, and password to use;
the later two options are permitted to be NULL, if you hate security on
your network. ;)

This simply emplaces the data, and does not yet provide commands to manipulate
or act on that data.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement IPMI credential updates

This adds a command, documentation and tests, to allow users to update the
node IPMI details using the Razor client.  This simply allows updates, making
it practical to associate existing nodes with their BMC/IPMI lan or
lanplus interface.

This, in turn, allows us to start managing power state for the target node.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add BMC GUID queries and IPMI infrastructure

This implements the basic infrastructure for running synchronous IPMI commands
against a remote host, using external command execution.  That is leveraged to
execute the BMC GUID query, as a proof that the concept works correctly.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement power state query, and `on?` helper, for IPMI

This implements the next IPMI operation, testing the remote power state, to
determine if the machine is on or off.  This is a trivial read-only query.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement "boot from this device once" IPMI support

This adds support for setting a (temporary) boot device via IPMI; the most
likely use-case for Razor is to set it to `pxe` on a node as part of a higher
reliability infrastructure.  (eg: boot local by default, override to PXE on
demand only. :)

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Support capturing the "last observed power state" of nodes

This extends the node object to capture the last observed power state -- and
the time it was observed -- as part of the stored data.  This will allow us to
store the results of observing the power state of the node via IPMI.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Wire up node power state update logic via IPMI

This adds a simple logic wrapper that handles errors and updates power state
in a central fashion to the node object.  This is also the entry point that we
can use to trigger background processing by sending that message,
asynchronously, to the node instance.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement the TorqueBox scheduled job class to trigger power polling

This implements the logic behind monitoring power state for nodes: trigger a
regular update in the background for any eligible node.  We implement the Ruby
class that TorqueBox triggers from the scheduled job poller here.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Deploy the scheduled IPMI job into TorqueBox

This wires up the task scheduler and the IPMI power state update job to work
together, so that we kick off a power state check every five minutes.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add a new-style Chef broker

The Chef broker requires a few inputs from the user, so a sample JSON
configuration is included.

Since the configuration JSON is stored as one string in the database, I
needed to pass the validation file as one line and re-create valid file
format on the broker hand off.
Update set_hostname.erb
added -v to allow install.sh to parse the version parameter
* README.md: add pointer to JIRA bug tracker

We now track bugs there, not in Github issues
* doc/api.md: fix error in create-broker example

Fixes https://github.com/puppetlabs/razor-server/issues/75 reported by
https://github.com/maishsk
Update boot notification to be clearer

The current boot notification claimed that we were booting locally, when we
actually exited the iPXE system and asked the firmware to boot from the next
device.  This updates the message to avoid confusion when people observe the
actual behaviour and wonder if something is going wrong...

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add Apache Shiro based RBAC to razor-server

This adds the JAR files for Apache Shiro, and dependencies, to the project.

It also wires up to initialize a Shiro security manager and ensure it is
available for use across the project.  This is wired to an external
configuration file, pleasantly addressed from our own configuration, and
is the recommended strategy for per-application security management.

It adds a rack middleware to bind the security context around
application execution, and enforces our requirement for successful HTTP
Basic auth over the API space.

It also updates the various API tests to ensure they appropriately
authenticate before invoking web requests, to mirror the new policy.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Add example Shiro configuration files

This adds a few Shiro configuration file examples, showing how various
authentication sources can be configured inside the application -- completely
transparently to Razor.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Make authentication optional, disabled if not specified

This makes the authentication implementation a little more compatible with
previous deployments: unless you turn on authentication, it is disabled and
there are no restrictions to accessing the `/api` URL space.

When enabled this enforces the same rules as before: you must have valid
credentials to be able to access the namespace at all.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
Implement command RBAC security checks

This adds the infrastructure to support permission checks for users, and ties
in all the commands to them.  This is the simplest version: it restricts based
on the command and the target object name.

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