- From: Adam Jacob <
- Subject: [chef] Re: Re: Re: Trigger an ohai update within a recipe?
- Date: Mon, 26 Jul 2010 12:35:54 -0700
Yep - it is blocking, it is just two-phase (compile and execute.)
On Mon, Jul 26, 2010 at 12:02 PM, Alex Soto
> Going off the top of my head, so dbl check the docs, but try:
> setting 'action :nothing' on the ruby block
> then 'notifies :action, resources(:ruby_block => 'reload_ohai'),
> :immediate' in the resource you want to trigger the block
> On Jul 24, 2010, at 11:38 PM, Leinartas, Michael wrote:
> Well here's one way I found, though I'm hoping there's something cleaner
> than this out there:
> ruby_block "reload_ohai" do
> block do
> ohai = Ohai::System.new
> node.automatic_attrs = ohai.data
> I tried having this executed by a notify but it doesnt work, I think because
> notify appears to be non-blocking and ohai takes a few seconds to collect
> the data. By the time that happens, the template resource has already been
> called. Kindof sucks because it means this ohai reload will take place
> every time the script is run, not just when the user is created on the first
> From: "Leinartas, Michael"
> Date: Sat, 24 Jul 2010 20:34:26 -0500
> Subject: [chef] Trigger an ohai update within a recipe?
> I'm running into a problem with a recipe. This seems like a common case so
> I'm hoping there's a simple solution.
> I have a recipe that configures a daemon (maradns fwiw) which drops root
> privileges to a uid/gid configured in the daemon's config file which is
> generated by a template. The recipe first runs the User resource to create
> the user if necessary.
> So the problem is, in the template I refer to
> node[:etc][:passwd][:maradns][:uid] and node[:etc][:group][:maradns][:gid]
> but at that point ohai hasn't picked up those values and cached them so the
> template generation fails. On a subsequent run, the template is generated
> So is there some way for me to trigger an update of ohai within the recipe?
> If not, I'll file a bug for a feature request as, again, this seems like a
> relatively common case.
Adam Jacob, CTO
T: (206) 508-7449 E:
Archive powered by MHonArc 2.6.16.