crowbar/barclamp-crowbar — pull request #652 by cloudedge (2013-08-11 03:56:46+00:00)
Title: Refactor Deployment pointers to treat snapshots like a linked list [1/1]

This refactoring greatly simplifies how deployments are managed by Crowbar. It was orginally a longer term design objective,
but streamlined the code when we pulled it in.

Basically, we are now treating snapshots like a linked list instead of 3 descrete pointers. The deployment has a pointer
to the head of the list (which is the proposal/committed/active snapshot). When a new proposal is needed, we simply add
to the head of the list and move the deployment pointer.

Consequently, the STATUS information is much much easier. We do NOT use deployment pointers for status, we get it directly
from the node roles attached to the head of the deployment.

Victor and I felt in discussion that this was easier to explain and much more "truthy" about the actual state.

It also made the code smaller. Profit!

This code includes another MILESTONE... from the UI, you can now commit, anneal and then propose a deployment.

PLEASE READ THAT AGAIN > you can now commit, anneal and propose a deployment in cycle.

One last goodie - I have a bunny refresh candidate (CB2 only). Feedback welcome.

BDD/deployment.erl | 6 +-
BDD/features/snapshot.feature | 2 +-
BDD/snapshot.erl | 3 +-
.../app/controllers/deployments_controller.rb | 14 +--
.../app/controllers/snapshots_controller.rb | 18 +++
crowbar_framework/app/models/attrib.rb | 33 +-----
crowbar_framework/app/models/deployment.rb | 125 +++++---------------
crowbar_framework/app/models/node_role.rb | 10 --
crowbar_framework/app/models/snapshot.rb | 57 +++++++--
.../app/views/deployments/_buttons.html.haml | 15 ++-
.../app/views/deployments/index.html.haml | 44 +++----
.../app/views/deployments/show.html.haml | 28 +++--
.../app/views/snapshots/_index.html.haml | 25 ++++
.../app/views/snapshots/index.html.haml | 26 +---
.../app/views/snapshots/show.html.haml | 23 ++--
.../config/initializers/crowbar_deployment.rb | 3 +-
crowbar_framework/config/locales/crowbar/en.yml | 10 +-
crowbar_framework/config/routes.rb | 16 +--
.../migrate/20120731225466_create_deployments.rb | 4 +-
.../db/migrate/20120731225476_create_snapshots.rb | 1 +
crowbar_framework/public/404.html | 2 +-
crowbar_framework/public/500.html | 4 +-
crowbar_framework/public/images/failbunny.png | Bin 38485 -> 23620 bytes
crowbar_framework/public/images/icons/bunny.ico | Bin 9662 -> 370070 bytes
.../shared_contexts/base_deployement_nodes.rb | 6 +-
crowbar_framework/test/unit/node_model_test.rb | 2 +-
26 files changed, 219 insertions(+), 258 deletions(-)

Crowbar-Pull-ID: 3d51d0b1f19b5e646cad9ccb535227edcfc1361f

Crowbar-Release: development