Getting this error when using knife command


#1

I have permission to update the cookbook but this error is coming even
listing the nodes.

C:\Users\dharmesh.patel\chef-repo\chef-repo\trunk>knife node list
ERROR: You have an error in your config file
C:/Users/dharmesh.patel/chef-repo/c
hef-repo/trunk/.chef/knife.rb
TypeError: can’t convert nil into String
C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:in
initial ize' C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:inopen’
C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:in
`from_st
ring’

 # C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb

2:
3: config = YAML::load(File.open(ENV[“CHEF_CONFIG”]))
4: provider = ENV[‘CHEF_PROVIDER’] || “internal”


Thanks & Regards

Dharmesh Patel


#2

It looks like the author of your knife.rb file expected the environment
variable, “CHEF_CONFIG“, to exist and it doesn’t. That is,
ENV[“CHEF_CONFIG”] is returning nil which in turn can’t be used as a file
name to open.

I’m guessing here, but it looks like the intention was for that environment
variable to contain the path to a YAML file that has some configuration in
it? This isn’t a default behavior, as far as I know. Perhaps your
organization has some documentation to refer to?

Sadly, my Windows knowledge is pretty poor; I might be missing something.

Matt Moretti

On Wed, Dec 24, 2014 at 11:44 AM, dharmesh patel <dharmeshradadiya@gmail.com

wrote:

I have permission to update the cookbook but this error is coming even
listing the nodes.

C:\Users\dharmesh.patel\chef-repo\chef-repo\trunk>knife node list
ERROR: You have an error in your config file
C:/Users/dharmesh.patel/chef-repo/c
hef-repo/trunk/.chef/knife.rb
TypeError: can’t convert nil into String
C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:in
initial ize' C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:inopen’
C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:in
`from_st
ring’

 # C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb

2:
3: config = YAML::load(File.open(ENV[“CHEF_CONFIG”]))
4: provider = ENV[‘CHEF_PROVIDER’] || “internal”


Thanks & Regards

Dharmesh Patel


#3

Thanks Matt.

Environment variable was messed up in my windows machine. I did fixed this
issue. It is working as expected.

On Wed, Dec 24, 2014 at 12:12 PM, Matthew Moretti werebus@gmail.com wrote:

It looks like the author of your knife.rb file expected the environment
variable, “CHEF_CONFIG“, to exist and it doesn’t. That is,
ENV[“CHEF_CONFIG”] is returning nil which in turn can’t be used as a file
name to open.

I’m guessing here, but it looks like the intention was for that
environment variable to contain the path to a YAML file that has some
configuration in it? This isn’t a default behavior, as far as I know.
Perhaps your organization has some documentation to refer to?

Sadly, my Windows knowledge is pretty poor; I might be missing something.

Matt Moretti

On Wed, Dec 24, 2014 at 11:44 AM, dharmesh patel <
dharmeshradadiya@gmail.com> wrote:

I have permission to update the cookbook but this error is coming even
listing the nodes.

C:\Users\dharmesh.patel\chef-repo\chef-repo\trunk>knife node list
ERROR: You have an error in your config file
C:/Users/dharmesh.patel/chef-repo/c
hef-repo/trunk/.chef/knife.rb
TypeError: can’t convert nil into String
C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:in
initial ize' C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:inopen’
C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb:3:in
`from_st
ring’

 # C:/Users/dharmesh.patel/chef-repo/chef-repo/trunk/.chef/knife.rb

2:
3: config = YAML::load(File.open(ENV[“CHEF_CONFIG”]))
4: provider = ENV[‘CHEF_PROVIDER’] || “internal”


Thanks & Regards

Dharmesh Patel


Thanks & Regards

Dharmesh Patel (B.E.I.T)