> -----Original Message-----
> From: crowbar-bounces On Behalf Of James Tan
> Sent: Wednesday, March 13, 2013 1:57 PM
> To: Vincent Untz
> Cc: crowbar
> Subject: Re: [Crowbar] Porting core cookbooks to attribute injection
>
> On 03/07/2013 11:13 AM, Vincent Untz wrote:
> > Hi,
> >
> > First, thanks for the overview on attribute injection in yesterday's
> > call. This was quite useful to better understand what this all means
> > and why we are moving this way, as well as how things can look like
> > (with the keystone cookbook example).
> >
> > Ideally, we'd have a good example of porting a cookbook of a core
> > barclamp to AI, which people can use as model when porting the other
> > cookbooks. Is anybody working on such an example?
>
> Agreed, a reference implementation would be very useful. Do we already have
> something like that? If not, let's pick one and make it so?
>

So we have some partial examples, but nothing that completes the whole story. 
But, rather than wait for a complete example - could be incremental on this?

You might recall that the main drivers were:
* remove crowbarisms (or at least make them optional) so we can better share 
cookooks
* limit search as much as possible.

The swift cookbook is somewhat of a good example for the first, but not the 
second. If you look at the default attributes in [1] and specifically [2], and 
compare it to [3].

There are a few ideas from the AttrInj discussion that are captured by this 
example, and a few that are missing (the second list):
1) Default attributes set by the cookbooks, and server as an "API" of 
attributes that the recipe requires.
2) Those default attributes don't require "crowbar-ism" - in fact you can run 
them with just chef.
3) The default attributes are overridden to refer to values referring 
attributes generated by crowbar (a more full example below).
4) library wrappers for access to some attributes [4]. Though in this case, 
it's not deployment wide (as openstack-common), but rather embedded in swift... 
which should probably change to look more like [5].


What's not manifested:
1) search replacement
2) some form of allowing for pluggability of providers for services - e.g. [6]
3) library to publish status/info back into the server (outside of ohai) , e.g. 
to indicate if non-fatal failures have occurred in some recipe [7]


A walk through example for overriding attributes:
In the default attributes (used outside of crowbar) the source of disks to be 
used in swift storage nodes, is the ohai info, and it has very basic filtering:

# expression to find a hash of possible disks to be used.
default[:swift][:disk_enum_expr]= 'node[:block_device]'
# expression accepting a k,v pair for evaluation. if expression returns true, 
then the disk will be used.
# by default, use any sdX or hdX that is not the first one (which will hold the 
OS).
default[:swift][:disk_test_expr]= 'k =~/sd[^a]/ or k=~/hd[^a]/'

When run in crowbar, that attribute is overridden (using a role override 
attribute, that are ""injected"" into the proposal configuration) to refer to 
data put on the node like so (from [3]).
"disk_enum_expr": "node[\"crowbar\"][\"disks\"]",
"disk_test_expr": "v[\"usage\"] == \"Storage\"",


Hope this setting the general ""tone"" if not quite a pattern of the place 
we're trying to march to.




[1] 
https://github.com/cloudedge/barclamp-swift/blob/master/chef/cookbooks/swift/attributes/default.rb
[2] 
https://github.com/cloudedge/barclamp-swift/blob/master/chef/cookbooks/swift/attributes/default.rb#L48
[3] 
https://github.com/cloudedge/barclamp-swift/blob/master/bc-template-swift.json#L27
[4] 
https://github.com/cloudedge/barclamp-swift/blob/master/chef/cookbooks/swift/recipes/proxy.rb#L23
[5] 
https://github.com/att-cloud/cookbook-openstack-common/blob/master/libraries/endpoints.rb
[6] 
https://github.com/rcbops-cookbooks/monitoring/blob/master/providers/procmon_monit.rb
[7] 
https://github.com/crowbar/barclamp-ipmi/blob/master/chef/cookbooks/ipmi/recipes/ipmi-configure.rb#L48







> Cheers,
> James T.
>
>
> _______________________________________________
> Crowbar mailing list
> Crowbar@dell.com<mailto:Crowbar@dell.com>
> https://lists.us.dell.com/mailman/listinfo/crowbar
> For more information: http://crowbar.github.com/

_______________________________________________
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