Hi,

I just submitted this pull request, which I guess is worth discussing
here:
  https://github.com/crowbar/barclamp-crowbar/pull/589

Here's a copy and paste from the commit message:

===================
Until now, when creating a proposal with some existing json, it was
required that the json contained a full proposal definition. Two big
downsides of this are:

a) it's easy to break stuff by accident when changing a proposal
b) if the schema changes to add new mandatory attributes, people can
not simply re-use old json they had around; they have to update them

This commit allows passing an incomplete json with only a subset of
attributes. It will take the default json, and overwrite any attribute
there with the ones from the incomplete json.

Note that this is note using Chef::Mixin::DeepMerge::deep_merge! as a
deep merge is also merging arrays in attribute values, which is
something not desired here. The hash_only_merge! API is actually
available in Chef 11 in Chef::Mixin::DeepMerge, so this is just a
backport.

For all that matters, this is backwards-compatible.
===================

The main benefit I see is that it makes it really easy to use a json
like this to create a database proposal using postgresql:

{
  "id": "mydbproposal",
  "attributes": {
    "database": {
      "sql_engine": "postgresql"
    }
  }
}

All the missing attributes will be fetched from the database databag.

Any objection?

Vincent

-- 
Les gens heureux ne sont pas pressés.

_______________________________________________
Crowbar mailing list
Crowbar@dell.com
https://lists.us.dell.com/mailman/listinfo/crowbar
For more information: http://crowbar.github.com/

Reply via email to