akshayg21
akshayg21

Reputation: 51

chef-- knife cookbook upload gives error ERROR: Errno::ENOENT: No such file or directory, on windows

I am new to Chef and learning it from Lynda, tutorial by Robin Beck. I am using Windows 10 and have installed ChefDk as per instructions in the tutorial. The tree structure is as below:

C:.
├───.chef
├───cookbooks
│   └───apache
│       ├───.delivery
│       │   └───build_cookbook
│       │       ├───data_bags
│       │       │   └───keys
│       │       ├───recipes
│       │       ├───secrets
│       │       └───test
│       │           └───fixtures
│       │               └───cookbooks
│       │                   └───test
│       │                       └───recipes
│       ├───recipes
│       ├───spec
│       │   └───unit
│       │       └───recipes
│       ├───templates
│       │   └───default
│       └───test
│           └───recipes
└───roles

I am trying to upload the cookbook using knife command:

knife cookbook upload apache

I am running the command from "chef-repo" directory but I am getting an error as below:
ERROR: Errno::ENOENT: No such file or directory

Please find below the screenshot for more information.

enter image description here

Please help, thanks in advance!

EDIT:

Please find below the output of the knife.rb file.

#See http://docs.chef.io/config_rb_knife.html for more information on knife configuration options

current_dir = File.dirname(__FILE__)

log_level                :info

log_location             STDOUT

node_name                "hakiuser"

client_key               "#{current_dir}/hakiuser.pem"

chef_server_url          "https://api.chef.io/organizations/cheflynda"

cookbook_path            ["#{current_dir}/../cookbooks"]

Upvotes: 0

Views: 881

Answers (2)

Bob
Bob

Reputation: 1

I'm taking the same class and ran into the same problem. There must be something wrong with the Apache included with the class. I downloaded a different one from: https://supermarket.chef.io/cookbooks/apache2 I was able to upload this one. Don't know how it's going to work though but at least I can proceed to the next lesson.

Upvotes: 0

nmanh
nmanh

Reputation: 335

Did you try uploading from the cookbook path? In your case:

cd C:\Users\Akshay\Downloads\Compressed\chef-repo\cookbooks knife cookbook upload apache

if this doesn't work you can give the absolute path to the cookbook in the upload as well.

knife upload -o PATH:PATH, --cookbook-path PATH:PATH

If above still doesn't work, could you print the output of your knife.rb? There should be your path to the chef-repo. Under

knife[:chef_repo_path]

Upvotes: 0

Related Questions