- From: AJ Christensen <
>
- To: chef <
>
- Subject: [chef] Re: Re: Re: My Wishlist: Better Chef-Solo Support
- Date: Thu, 21 Feb 2013 10:46:02 +1300
This stubbed search thing is sick - I had a similar idea as the
extension point to bolting in more advanced discovery mechanisms
(intercept search/databag lookup, translate to Super Discovery Thing)
Very cool -- will play with this more. Thanks Fletcher!
--AJ
On 21 February 2013 10:44, Fletcher Nichol
<
>
wrote:
>
On Wednesday, 20 February, 2013 at 1:03 PM, Seth Chisamore wrote:
>
>
>
> On Feb 20, 2013, at 1:32 PM, Elliot Murphy
>
> <
>
>
>
> (mailto:
)>
>
> wrote:
>
>
>
> > On Wed, Feb 20, 2013 at 1:02 PM, Torben Knerr
>
> > <
>
> >
>
> > (mailto:
)>
>
> > wrote:
>
> > Sadly, each of these provide different levels of parity with
>
> > chef-client, e.g. knife-solo adds search via edelight/chef-solo-search,
>
> > but this is not supported by the other approaches. I guess all of them
>
> > support data bags. Not sure if anyone of them already supports
>
> > environments under chef-solo...
>
> >
>
> > I had been planning some work thinking that chef-solo-search would work
>
> > in a vagrant environment by just adding the cookbook - does it not work?
>
> > I haven't tested yet, but if someone else has already been down this
>
> > route it might save me from going down a dead end.
>
>
>
> Have you taken a look at Fletcher Nichol's searchef [0] (and it's
>
> associated cookbook [1])? It allows you to stub out the search request at
>
> the HTTP request level:
>
>
>
> # search for nodes
>
> stub_search(:node, "roles:web_node").to_return([
>
> node_stub("web1.example.com (http://web1.example.com)"),
>
> node_stub("web2.example.com (http://web2.example.com)")
>
> ])
>
>
>
> # search in data bag
>
>
>
> stub_search(:users, 'groups:admin').to_return([
>
> {
>
> "id" => "adam",
>
> "comment" => "Adam Administrator",
>
> "groups" => [
>
> "admin"
>
> ],
>
> "ssh_keys" => [],
>
> "shell" => "/bin/bash"
>
> }
>
> ])
>
>
>
> stub_search(:users, 'groups:admin').to_return([
>
> data_bag_item("users", "adam")
>
> ])
>
>
>
> We have been using this a bit internally when running our cookbooks in
>
> 'development' mode, i.e. in Vagrant.
>
>
>
> --
>
> Seth Chisamore
>
> Software Development Engineer, Opscode, Inc.
>
> IRC, Skype, Twitter, Github: schisamo
>
>
>
> [0] - https://github.com/fnichol/searchef
>
> [1] - https://github.com/fnichol/chef-searchef
>
>
Thanks Seth!
>
>
Searchef is still reasonably young (started last Tuesday) but was written
>
to help with testing cookbooks that depend heavily on search, but are being
>
exercised in solo mode. Think stubbing (dumb responses) rather than
>
emulating search. Now that it's in the wild, I'll push the cookbook to the
>
community site :)
>
>
Fletcher.
>
>
p.s. While stubbing out search responses might be clever, please also
>
consider adding solo mode detection with `Chef::Config[:solo]` if the
>
cookbook is meant for public consumption. Sometimes looking in a node
>
attribute for your data is a great alternative for solo. After all, don't
>
forget FC003 [0] :)
>
>
[0] - http://acrmp.github.com/foodcritic/#FC003
Archive powered by MHonArc 2.6.16.