Code in library method being executed during compile time?

From all I can tell, I am seeing behavior that indicates that some of my code inside a method in libraries/helpers.rb is being executed during the compile phase of a chef run.

In the case shown, at compile-time, the directory resource of course has not executed yet so of course there is no destination directory to mv the file to. It’s not supposed to be executing the mv until the converge phase!

Does anyone have any clue what is going on here? This is Chef Client 12.17.something

Hi Jeff,
Why do you think that wouldn’t get executed in the compile phase? It’s
just straight up ruby code (also, that ought to be a custom resource!)

Hi Thommay,

Sure, it’s straight up ruby code. But it’s defined in methods. Why would statements inside a method be executed before the method is called (during convergence)?

OHHHH. I need this in my recipe I guess?

ruby_block 'whatever' do
  block do

I think I screwed myself by mentally thinking of the method call as a resource call.