My suggestion is that you make the ruby_block a part of the definition itself.
+61 414 867 559
Mark Pimentel firstname.lastname@example.org wrote:
I actually like to get ideas from people as they may provide insight to tackling a problem in such a way I may not have considered. So your response is appreciated.
I have a recipe that deploys these artifacts from a nexus repo. They are simple archives and are controlled by a yaml file that I ship with the cookbook. I have a definition that I call for each one of these artifacts that are to be deployed.
Currently, I parse that yaml control file then make iterative calls to the nexus repo for the artifact information. Then I make a descision as to whether I need to deploy the artifact, or update it if it is newer than the one I have. This is controlled by dumping the nexus api call to a templated response file. If the templated response file changes, that triggers other resources in the definition to act, which is to deploy the artifact. That is the definition.
Now, the reason I want to have this definition embedded into a ruby block is to control the execution of those api calls. Currently they fire because I parse the yaml control file and iterate over each entry calling the definition. This occurs in pure ruby, which I know is called inline with the compile phase. I wanted to push this into the ruby block to have it called in the convergence phase instead.
Hope that sheds light on my problem. And once again thank you for your response and interest.
Let me just say that, when I ask for help and get back someone telling me to do what I want a different way, it really annoys me. So feel free to tell me to shove off, BUT, with that said…
Can you share what you’re trying to accomplish and maybe we can help you get there without trying to embed one resource block within another, which is really what you’re talking about doing?
Mark Pimentel wrote:
I need some guidance on how to call a definition from a ruby block.
Any help would be greatly appreciated.