Preserve value between definitions call?


#1

Hello chefs,

I was really surprised to find out that when the same definition is
called one after one in the same recipe the recipe instance is different!
How is it possible? This messes up my understanding of chef again) The
more I work with chef the more interesting moments I constantly find out)

I was trying to save a value as an instance variable of recipe, but it’s
occured that those were different recipe instances. So it seems like
chef duplicates recipe instance when executing definition and probably
resource. Is it true?

Do you see any clean ruby way to preserve a value between definition calls?

Thank you,
Denis Barishev