Vincent Untz ([email protected]) wrote:
> 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?

This sounds really nice to me - it cleanly separates out what the
admin wants to be different from the defaults, rather than mixing
those values with the defaults.  This should make upgrades smoother in
the future as you say, although I expect a forward-port to CB2.0 is
non-trivial.  Thanks!

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

Reply via email to