0

in Windows,Unable to upload cookbook to hosted chef server. my Knife.rd 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                "xxxxx"
client_key               "#{current_dir}/xxxxx.pem"
validation_client_name   "wis-validator"
validation_key           "#{current_dir}/wis-validator.pem"
chef_server_url          "https://api.chef.io/organizations/xxxx"
cookbook_path            ["#{current_dir}/../cookbooks/"]

When i run knife upload learn_chef_apache2 command, getting below error message

ERROR: Attempt to use relative path 'learn_chef_apache2' when current directory is outside the repository path. ERROR: Current working directory is 'E:/Prasanna_POC/learn_chef'.

I'm running the knife upload command from the path where cookbooks folder present and inside that learn_chef_apache2 cookbook present

StephenKing
  • 36,187
  • 11
  • 83
  • 112
user2439278
  • 1,222
  • 7
  • 41
  • 75

2 Answers2

0

I think you mean to be running knife cookbook upload learn_chef_apache2. The knife upload command is more generic and uploads many types of things, but you need to give it the path to the object.

coderanger
  • 52,400
  • 4
  • 52
  • 75
0

When you run command: knife upload learn_chef_apache2, you must make sure cookbook learn_chef_apache2 inside your cookbook_path.

cookbook_path set in your knife.rb file.

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

Please make sure this is : knife.rb not Knife.rd

mnille
  • 1,328
  • 4
  • 16
  • 20
HaiBac Do
  • 31
  • 4