crowbar/barclamp-provisioner — pull request #208 by VictorLowther (2013-10-06 11:41:10+00:00)
Title: CB 2.0: Switch to Postgres for production, and refactor the provisioner BC to hook it back into the node lifecycle. [2/3]

This pull request is mostly for feedback right now, and does the
following:

* Switch from sqlite to postgres for our production database. Since
we were running several processes in parallel banging on sqlite, we
were getting occasional locking violations that could only be
cleared by restarting Crowbar. Since that problem will only get
worse as we parallelize things, switch to a real database that
handles multiple concurrent connections just fine -- Postgres.
* Refactor the provisioner to hook it back into the node lifecycle.
This lets the provisioner start managing its DHCP and PXE
functionality on a per-node basis again.

For now, I am using Postgres 9.3 from the package repositories
maintained by postgresql.org. This should allow us to start taking
advantage of some of the nicer things that have been happening in the
9.x development branch w.r.t JSON handling. The Crowbar postgres
install is currently restricted to listening on a UNIX socket that it
trusts implicitly, so the only security we have there is that Postgres
is not reachable using IP. This was done to ease bootstrapping and to
not interfere with the Postgres instance that chef-server needs to set up.

chef/cookbooks/dhcp/recipes/default.rb | 40 +-
chef/cookbooks/provisioner/providers/bootfile.rb | 61 +++
chef/cookbooks/provisioner/recipes/dhcp_update.rb | 29 --
.../provisioner/recipes/setup_base_images.rb | 7 +-
chef/cookbooks/provisioner/recipes/update_nodes.rb | 448 +++++++++------------
chef/cookbooks/provisioner/resources/bootfile.rb | 22 +
chef/roles/provisioner-dhcp-database.rb | 5 +
chef/roles/provisioner-dhcp-server.rb | 5 +
.../provisioner-dhcp-server/role-template.json | 8 +
chef/roles/provisioner-server.rb | 2 -
chef/roles/provisioner-server/role-template.json | 22 +-
crowbar.yml | 12 +
.../models/barclamp_provisioner/dhcp_database.rb | 71 ++++
13 files changed, 419 insertions(+), 313 deletions(-)

Crowbar-Pull-ID: 1894f0c22097ce2fe14718ee0722577a3af82967

Crowbar-Release: development