At some point you will need to write code though... Chef is "Infrastructure as Code". I totally understand the desire to touch a few attributes and have a fully working "thing", but that proves to be highly unsustainable both from a cookbook maintenance standpoint (it's hard to test) and from an infrastructure reasoning standpoint (it's very difficult to determine the "flow" of a cookbook's behavior when everything is driven by attributes).The argument that you "need a bunch more lines of code" is a bit lost on me. JSON is still code, and it's arguable more complex and difficult to reason about that Ruby code. Just because it is not "Ruby" does not mean it is not "code". Every line in an attribute file, role, or environment JSON is code.We took a similar approach with the Jenkins cookbook rewrite and only utilize attributes where they make sense. Everything else is treated as a Chef resource (just like `user` or `package`). This has given the cookbook significantly more power and we have heard feedback that many user's like this pattern.- Seth@sethvargoOn Aug 25, 2014, at 12:43 PM, Bráulio Bhavamitra < " target="_blank"> > wrote:Seab and Lorent, I'm questioning the lack of use of node values in shared cookbooks, not on wrapper cookbooks. This makes us more dependent on wrapper cookbooks and needing a whole bunch of lines of code. This just doesn't make sense!
Em 25/08/2014 13:15, "Sean OMeara" < " target="_blank"> > escreveu:You can absolutely use node attributes to drive your recipe... same
way you would use core Chef resource.
Your example would look more like this...
node['httpd']['services'].each do |service_name, val1, val2|
httpd_service service_name do
listen_ports val1
run_user val2
end
end
-s
On Mon, Aug 25, 2014 at 11:22 AM, Bráulio Bhavamitra
< " target="_blank"> > wrote:
> But why left node values forgotten? LWRP can be used with node values, for
> example:
>
> node[:httpd][:services].each do |service|
> httpd_service do
> service.each{ |key, value| send key, value }
> end
> end
>
> Also, the provider could have a way to specify how node attributes should
> fill LWRP
>
> cheers,
> bráulio
>
>
> On Sat, Aug 23, 2014 at 1:04 AM, Lamont Granquist < " target="_blank"> >
> wrote:
>>
>>
>> Yep, agreed with all of that. There's the detail of why shareable recipes
>> have failed, though, and have been replaced by LWRPs. The more involved
>> members of the community have all come to that realization, but its come
>> at the
>> cost of years of fighting with it. I don't think the failures have been
>> enumerated
>> clearly so that others understand it.
>>
>>
>> On Fri Aug 22 18:54:45 2014, Adam Jacob wrote:
>>>
>>> I look at a little differently. I think, for most people, the promise
>>> of shareable recipes that encode policy has failed. If you make them
>>> flexible enough to matter (apaxhe2, say) you have a very complicated
>>> beast, when you probably only needed 20 lines of it.
>>>
>>> I think it may well be that the having resources be the prime unit of
>>> re-use, rather than recipes, may well be the right abstraction in the
>>> end.
>>>
>>> Adam
>>>
>>> On Aug 22, 2014 6:31 PM, "Lamont Granquist" < " target="_blank">
>>> <mailto: " target="_blank"> >> wrote:
>>>
>>> On Fri Aug 22 18:12:27 2014, Bráulio Bhavamitra wrote:
>>>
>>> I still cannot get this model of "all done by a wrapper
>>> cookbook using
>>> LWRP". It is just simpler to read node values...
>>>
>>>
>>> When you go down that road you eventually wind up needing two of a
>>> thing on a server and not just one instance. Then you start
>>> putting arrays of hashes in your attributes. Since you're now
>>> looping over an array and firing off a lot of resources you'll
>>> want to internally implement that problem as LWRPs anyway. Then
>>> eventually you'll wind up wanting to merge arrays in your
>>> attributes and you'll wind up on this page eventually:
>>> https://coderanger.net/arrays-__and-chef/
>>>
>>> <https://coderanger.net/arrays-and-chef/>
>>>
>>> Its much easier to just expose the LWRPs. Then the user can use
>>> node attributes, drive them with databags, or just statically code
>>> them in the LWRP.
>>>
>>
>>
>
>
>
> --
> "Lute pela sua ideologia. Seja um com sua ideologia. Viva pela sua
> ideologia. Morra por sua ideologia" P.R. Sarkar
>
> EITA - Educação, Informação e Tecnologias para Autogestão
> http://cirandas.net/brauliobo
> http://eita.org.br
>
> "Paramapurusha é meu pai e Parama Prakriti é minha mãe. O universo é meu lar
> e todos nós somos cidadãos deste cosmo. Este universo é a imaginação da
> Mente Macrocósmica, e todas as entidades estão sendo criadas, preservadas e
> destruídas nas fases de extroversão e introversão do fluxo imaginativo
> cósmico. No âmbito pessoal, quando uma pessoa imagina algo em sua mente,
> naquele momento, essa pessoa é a única proprietária daquilo que ela imagina,
> e ninguém mais. Quando um ser humano criado mentalmente caminha por um
> milharal também imaginado, a pessoa imaginada não é a propriedade desse
> milharal, pois ele pertence ao indivíduo que o está imaginando. Este
> universo foi criado na imaginação de Brahma, a Entidade Suprema, por isso a
> propriedade deste universo é de Brahma, e não dos microcosmos que também
> foram criados pela imaginação de Brahma. Nenhuma propriedade deste mundo,
> mutável ou imutável, pertence a um indivíduo em particular; tudo é o
> patrimônio comum de todos."
> Restante do texto em
> http://cirandas.net/brauliobo/blog/a-problematica-de-hoje-em-dia
Archive powered by MHonArc 2.6.16.