- From: AJ Christensen <
>
- To: chef <
>
- Subject: [chef] Re: Re: Re: Definition in a RubyBlock
- Date: Fri, 10 May 2013 09:57:50 +1200
RiotGames build a cookbook for deploying artifacts from Nexus. There
are many amazing examples diagrams and documentation.
Take a look. [0] [1]
It is not possible (thankfully!) to call definitions from inside of a
Ruby Block without extension. I'd advise re-factoring your entire
solution to be LWRPs + wrapper cookbooks -- or go ahead and use Riot's
cookbook.
You mention specifically a few cases where an LWRP makes perfect sense
-- the YAML Control. File parsing, mapping each of them and calling
the definition, API calls -- all could be easily achieved with LWRP
actions with correct ordering (convergence time)
Cheers,
AJ
[0]
http://community.opscode.com/cookbooks/artifact
[1]
https://github.com/RiotGames/artifact-cookbook
On 10 May 2013 09:52, Mark Pimentel
<
>
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.
>
>
>
On Thu, May 9, 2013 at 5:11 PM, Sascha Bates
>
<
>
>
wrote:
>
>
>
> Hi Mark,
>
>
>
> 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?
>
>
>
> Sascha
>
>
>
>
>
> Mark Pimentel wrote:
>
>
>
>
>
> I need some guidance on how to call a definition from a ruby block.
>
> Any help would be greatly appreciated.
>
>
>
> --
>
> Thanks,
>
>
>
> Mark
>
>
>
>
>
--
>
Thanks,
>
>
Mark
Archive powered by MHonArc 2.6.16.