- From: Brad Knowles <
>
- To:
- Cc: Brad Knowles <
>
- Subject: [chef] Re: Passing responses back to Chef?
- Date: Wed, 7 Aug 2013 13:40:47 -0500
On Aug 6, 2013, at 11:32 PM, Brad Knowles
<
>
wrote:
>
Okay, I created CHEF-4442 to cover this issue. If anyone has any questions
>
regarding the details of the matter and any improvements that I could make
>
to the ticket to be more useful, please let me know.
At this point, I'm pretty much stumped.
I discovered that I can't send a notify from a ruby_block to a package
resource -- that just generates an error. However, I can have the package
resource subscribe to the ruby_block, and get notifications that way. But
isn't a "subscribe" supposed to just be the opposite of a "notify"? How can
it work one way but not the other?
Now I seem to be running into problems about when things are compiled versus
when they are run. When the package resource is compiled, the
variable/attribute I want to use to set the version to be installed does not
yet exist, and even if it did exist, it would not yet contain the information
I want to use. So, it seems that a particular code path is chosen and
hard-wired based on the information that is available at compile-time, and
the other code paths are just thrown away.
By the time the version information is available to me through the
ruby_block, and the package resource gets the notification, it doesn't matter
because of that hard-wired code path.
I've tried the options shown at
<
http://docs.opscode.com/resource_common.html#run-from-resource-collection>
to control when things are executed (like, forcing the ruby_block to be
executed as early as possible, or forcing the package resource to have a
":delayed" execution), but because everything in the compile phase is done
before any part of the execution phase, this still doesn't fix the problem.
Thanks to Matt Ray, I did learn how to use mixlib-shellout to have Chef call
a program and get output back from it, which it could then use elsewhere in
the recipe. Unfortunately, that doesn't help me if I can't get that
information into a package resource to actually install that particular
version of the software.
Or should I just skip the package resource and install that version of that
software inside of my own ruby_block?
--
Brad Knowles
<
>
LinkedIn Profile: <
http://tinyurl.com/y8kpxu>
Archive powered by MHonArc 2.6.16.