Binding.pry kicking in at compile time rather than runtime


#1

Ohai Chefs,

I am running into an issue trying to debug a recipe with pry where the breakpoint binding.pry is kicking in at compile time, rather than at runtime

Compiling Cookbooks…

From: /var/chef/cache/cookbooks//attributes/default.rb @ line 7 Chef::Mixin::FromFile#from_file:

 3:
 4:
 5: require 'pry'
 6:

=> 7: binding.pry

Chef-client 11.18.12, pry gem is what comes with the omnibus install.

I’ve searched but haven’t found anything discerning compile vs. runtime invocation. I feel like I’m missing something simple, any help is greatly appreciated.

Thank you

The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or contact Practice Fusion at 415.346.7700 ext 4 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank you


#2

Put it inside a ruby_block, that delays running the code until converge time:

ruby_block ‘breakpoint’ do
block do
require 'pry’
binding.pry
end
end

If you are using chef-shell, you can also use the breakpoint resource, but these are ignored by chef-client.

–Noah

On May 20, 2015, at 7:50 PM, Alex Myasnikov amyasnikov@practicefusion.com wrote:

Ohai Chefs,

I am running into an issue trying to debug a recipe with pry where the breakpoint binding.pry is kicking in at compile time, rather than at runtime

Compiling Cookbooks…

From: /var/chef/cache/cookbooks//attributes/default.rb @ line 7 Chef::Mixin::FromFile#from_file:

 3:
 4:
 5: require 'pry'
 6:

=> 7: binding.pry

Chef-client 11.18.12, pry gem is what comes with the omnibus install.

I’ve searched but haven’t found anything discerning compile vs. runtime invocation. I feel like I’m missing something simple, any help is greatly appreciated.

Thank you

The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or contact Practice Fusion at 415.346.7700 ext 4 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank you


#3

Thank you Noah, that was exactly it.

-----Original Message-----
From: Noah Kantrowitz [mailto:noah@coderanger.net]
Sent: Wednesday, May 20, 2015 7:54 PM
To: chef@lists.opscode.com
Subject: [chef] Re: binding.pry kicking in at compile time rather than runtime

Put it inside a ruby_block, that delays running the code until converge time:

ruby_block ‘breakpoint’ do
block do
require 'pry’
binding.pry
end
end

If you are using chef-shell, you can also use the breakpoint resource, but these are ignored by chef-client.

–Noah

On May 20, 2015, at 7:50 PM, Alex Myasnikov amyasnikov@practicefusion.com wrote:

Ohai Chefs,

I am running into an issue trying to debug a recipe with pry where the breakpoint binding.pry is kicking in at compile time, rather than at runtime

Compiling Cookbooks…

From: /var/chef/cache/cookbooks//attributes/default.rb @ line 7 Chef::Mixin::FromFile#from_file:

 3:
 4:
 5: require 'pry'
 6:

=> 7: binding.pry

Chef-client 11.18.12, pry gem is what comes with the omnibus install.

I’ve searched but haven’t found anything discerning compile vs. runtime invocation. I feel like I’m missing something simple, any help is greatly appreciated.

Thank you

The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or contact Practice Fusion at 415.346.7700 ext 4 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank you