Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

private method `open' called for Chef::Provider::File:Class

Tags:

chef-infra

I'm trying to create a resource that writes all attributes to a file.

provider gist

resource gist

I'm getting the following error :

Error executing action run on resource 'ruby_block[dump_node_attributes]'`

NoMethodError

private method `open' called for Chef::Provider::File:Class

Cookbook Trace:

/Users/odedpriva/.chef/local-mode-cache/cache/cookbooks/test-helper/providers/create.rb:24:in `block (3 levels) in class_from_file'

Any idea what am I doing wrong?

like image 686
odedpr Avatar asked Feb 11 '23 16:02

odedpr


1 Answers

In your block, make that ::File.open. Unfortunately this is required because of Ruby's implicit relative symbol lookups. The leading :: forces it to be an aboslute symbol, like a leading / in a path.

like image 119
coderanger Avatar answered Feb 24 '23 15:02

coderanger