crowbar/barclamp-crowbar — pull request #346 by cloudedge (2013-01-15 22:50:17+00:00)
Title: Add Barclamp-Attrib relationship models [1/1]

This pull is a step to the inbound Jig path.

Basically, this work allow barclamps and attribs to be assiciated via a
has through relationship. The join model (BarclampAttrib) stores fields
that will be used for the next steps.

Order -> attrib precedence so that you can overlay attribs
Description -> hints about how to use the default parsing

I chose to use order & description because they are adequate terms for
these capabilities AND align with general Crowbar object naming.

The BarclampAttrib also has a name (generated) and uses the DB IDs. Unlike
NodeAttrib (which uses a calculated ID), I do not expect this table to move
to an in memory table for performance.

Next Step: I will make the barclamp.run_data method that takes in
JSON chef data and updates node attribtes to match.

crowbar_framework/BDD/attrib.erl | 6 +-
crowbar_framework/BDD/bdd.erl | 1 +
crowbar_framework/BDD/bdd_restrat.erl | 17 ++-
crowbar_framework/BDD/bdd_utils.erl | 5 +
crowbar_framework/BDD/cmdb.erl | 13 +-
crowbar_framework/BDD/crowbar.erl | 7 +-
crowbar_framework/BDD/features/attrib.feature | 18 +--
crowbar_framework/BDD/nodes.erl | 2 +-
crowbar_framework/app/models/attrib.rb | 22 +---
crowbar_framework/app/models/barclamp.rb | 41 +++---
crowbar_framework/app/models/barclamp_attrib.rb | 97 ++++++++++++++
crowbar_framework/app/models/node.rb | 4 +-
crowbar_framework/app/models/node_attrib.rb | 30 ++++-
crowbar_framework/app/models/role.rb | 3 +-
.../db/migrate/20120730227000_create_attribs.rb | 4 +-
.../20120731225456_create_barclamps_attribs.rb | 31 +++++
.../db/migrate/20120731225504_create_roles.rb | 3 +
.../migrate/20120731225600_create_node_attribs.rb | 5 +-
.../20120731230001_barclamp_import_crowbar.rb | 6 +-
crowbar_framework/test/unit/attrib_model_test.rb | 5 +-
.../test/unit/barclamp_attrib_model_test.rb | 134 +++++++++-----------
crowbar_framework/test/unit/barclamp_model_test.rb | 7 +
.../test/unit/node_attrib_model_test.rb | 66 +++++++++-
crowbar_framework/test/unit/node_model_test.rb | 5 +
24 files changed, 374 insertions(+), 158 deletions(-)

Crowbar-Pull-ID: a7c0d910def5e34e50dcb14c8a78e6680957a8e5

Crowbar-Release: development