chef-infraknife

CHEF - Attempt to use relative path 'foo when current directory is outside the repository path


When I try and run knife upload roles or knife upload /roles it gives the following error

cd ~/my-chef-repo
knife upload roles -n -V
INFO: Using configuration from /Users/sowen/.chef/knife.rb
ERROR: Attempt to use relative path 'roles' when current directory is outside the repository path

My knife.rb file

cookbook_path            "/Users/me/my-chef-repo"

Solution

  • This can happen when the cookbook_path is not properly set in your knife.rb

    Do the following:

    Make sure you have a trailing slash in your knife.rb

    cookbook_path            "/Users/me/my-chef-repo/"
    

    Or pass in the repo path from the commandline

    knife upload roles -n -VV --chef-repo-path /Users/me/my-chef-repo/