crowbar/barclamp-crowbar — pull request #647 by cloudedge (2013-08-05 04:57:31+00:00)
Title: Refactor Deployment pointers to treat snapshots like a linked list [1/2]

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/role.erl | 5 +-
BDD/snapshot.erl | 3 +-
.../app/controllers/deployments_controller.rb | 14 +--
.../app/controllers/snapshots_controller.rb | 27 ++++-
crowbar_framework/app/models/attrib.rb | 33 +-----
crowbar_framework/app/models/deployment.rb | 125 +++++---------------
crowbar_framework/app/models/node_role.rb | 19 +--
crowbar_framework/app/models/role.rb | 2 +-
crowbar_framework/app/models/snapshot.rb | 89 +++++++-------
.../app/views/barclamps/index.html.haml | 24 ++--
.../app/views/deployments/_buttons.html.haml | 15 ++-
.../app/views/deployments/index.html.haml | 44 +++----
.../app/views/deployments/show.html.haml | 28 +++--
.../app/views/node_roles/_index.html.haml | 24 ++++
.../app/views/node_roles/_raw.html.haml | 10 +-
.../app/views/node_roles/index.html.haml | 25 +---
.../app/views/node_roles/show.html.haml | 33 +++++-
crowbar_framework/app/views/nodes/index.html.haml | 9 +-
crowbar_framework/app/views/nodes/show.html.haml | 22 +++-
crowbar_framework/app/views/roles/_index.html.haml | 22 ++++
crowbar_framework/app/views/roles/index.html.haml | 20 +---
crowbar_framework/app/views/roles/show.html.haml | 23 +++-
.../app/views/snapshots/_index.html.haml | 25 ++++
.../app/views/snapshots/anneal.html.haml | 16 +++
.../app/views/snapshots/index.html.haml | 26 +---
.../app/views/snapshots/show.html.haml | 25 ++--
.../config/initializers/crowbar_deployment.rb | 3 +-
crowbar_framework/config/locales/crowbar/en.yml | 49 ++++++--
crowbar_framework/config/routes.rb | 24 ++--
.../migrate/20120731225466_create_deployments.rb | 4 +-
.../db/migrate/20120731225476_create_snapshots.rb | 1 +
.../db/migrate/20120731225510_create_roles.rb | 4 +-
.../db/migrate/20120801190200_scaffold_nav.rb | 21 ++--
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 +-
41 files changed, 437 insertions(+), 399 deletions(-)

Crowbar-Pull-ID: 19f38c540a236355f057e8c118e2f30804325799

Crowbar-Release: development