crowbar/barclamp-crowbar — pull request #382 by cloudedge (2013-02-09 20:25:52+00:00)
Title: Role HasNode via AttribInstance (death to NodeRole) [1/2]

This is the next-to-last major refactoring pull request!

In this pull, I have eliminated the NodeRole habtm table in favor of joining
through the AttribInstance table. This has the benefit of being simpler
and automatically managed by the BarclampInstance clone process.

The relationship has it's own class: AttribInstanceHasNode that provides
the needed filtering and relationship aspects to Node and RoleInstance.

Part of the needed behavior was to have make the RoleInstance required
for the AttribInstance model. This required the addition of the "user_defined"
role for the Crowbar model. If an attrib is created without a role then
crowbar will automatically use that role.

Eventually (not NOT implemented) this relationship could carry extra data via
the AttribInstance actual/request state information.

This change finally broke most of the hold Proposal logic so that was also
removed.

The next step is to add the BarclampConfiguration work including the CLI
and API for managing BarclampConfigurations. This will likely require
adding the concept of "active" vs "inactive" instances.

NOTE: There are some minor tweaks needed to address breaking or changed tests.

BDD/bdd_clirat.erl | 20 ++
BDD/bdd_utils.erl | 2 +-
BDD/features/scaffolds.feature | 34 +--
crowbar.yml | 101 ++++++++-
.../scaffolds/proposal_configs_controller.rb | 19 --
.../controllers/scaffolds/proposals_controller.rb | 19 --
crowbar_framework/app/models/attrib_instance.rb | 17 +-
crowbar_framework/app/models/barclamp.rb | 17 +-
.../barclamp_crowbar/attrib_instance_default.rb | 43 ++++
.../barclamp_crowbar/attrib_instance_has_node.rb | 41 ++++
.../app/models/barclamp_crowbar/barclamp.rb | 19 ++
.../app/models/crowbar/attrib_instance_default.rb | 43 ----
crowbar_framework/app/models/crowbar/barclamp.rb | 60 -----
crowbar_framework/app/models/node.rb | 173 +++++++++------
crowbar_framework/app/models/node_role.rb | 52 -----
crowbar_framework/app/models/proposal_config.rb | 230 --------------------
crowbar_framework/app/models/role_instance.rb | 28 ++-
crowbar_framework/app/models/role_map.rb | 31 ---
crowbar_framework/config/locales/crowbar/en.yml | 2 +
crowbar_framework/config/routes.rb | 4 +-
.../db/migrate/20120731225505_create_node_roles.rb | 27 ---
.../20120731225600_create_attrib_instances.rb | 4 +-
.../db/migrate/20120810233501_create_role_maps.rb | 27 ---
crowbar_framework/test/test_helper.rb | 5 +
.../test/unit/attrib_instance_has_node_test.rb | 105 +++++++++
.../test/unit/barclamp_import_test.rb | 2 +-
.../test/unit/barclamp_node_data_test.rb | 9 +-
crowbar_framework/test/unit/node_model_test.rb | 15 +-
.../test/unit/node_role_model_test.rb | 40 ----
crowbar_framework/test/unit/role_map_model_test.rb | 30 ---
30 files changed, 515 insertions(+), 704 deletions(-)

Crowbar-Pull-ID: c0d9a908fdcf7a23f9302ab74173401a4f2e679b

Crowbar-Release: development