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
< "> > 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 < "> >
> 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" < ">
>>> <mailto: "> >> 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.