Knife not using knife.rb?


#1

Chef: 14.1.12 Windows 10
Going through the tutorial I have my knife.rb at ~/learn-chef/.chef/knife.rb (C:\users\wdavis\learn-chef.chef\knife.rb)

I run the ssl fetch
knife ssl fetch

Results:
    INFO: Using configuration from C:/Users/wdavis/learn-chef/.chef/knife.rb
    WARNING: Certificates from localhost will be fetched and placed in your trusted_cert
    directory (c:\users\wdavis\learn-chef\.chef\trusted_certs).

    Knife has no means to verify these are the correct certificates. You should
    verify the authenticity of these certificates after downloading.

    ERROR: Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect

Here is my knife.rb:

current_dir = File.dirname(__FILE__)
log_level                 :info
log_location              STDOUT
node_name                 "chefadmin"
client_key                "#{current_dir}/chefadmin.pem"
chef_server_url           "https://synchef.url.com/organizations/syn"
cookbook_path             ["#{current_dir}/../cookbooks/"]

However, if I run:
knife ssl fetch https://synchef.url.com

It works fine - so why isnt it working when just using the knife.rb?

I should also add I’m seeing similar issues when trying to upload cookbooks. It says its using my knife.rb and the cookbooks are obviously there but it claims it cannot find them.

So it seems to me maybe it isnt really using the knife.rb it should?

and here is another example:

knife ssl check -V
INFO: Using configuration from C:/Users/wdavis/learn-chef/.chef/knife.rb
Connecting to host localhost:443
ERROR: Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect

Why is it trying to connect to localhost:443? That isnt what is configured in my knife.rb


#2

I’m also learning this part.
Since the 2nd command works, I guess the knife.rb was used.
try to use :

in knife.rb instead of full organization name.


#3

I wrote the original file in VS Code - which saved the file as UTF-16 LE. I noticed that in the starter kit I downloaded the file was UTF-8. I resaved my file in UTF-8 and the command worked fine. It seems that the version of ruby shipped with ChefDk doesnt like UTF-16LE?