CHEF - 当当前目录在存储库路径之外时尝试使用相对路径 'foo
CHEF - Attempt to use relative path 'foo when current directory is outside the repository path
当我尝试 运行 knife upload roles
或 knife upload /roles
时出现以下错误
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
我的knife.rb文件
cookbook_path "/Users/me/my-chef-repo"
如果 cookbook_path 在 knife.rb
中设置不正确,就会发生这种情况
执行以下操作:
确保您的 knife.rb
中有尾部斜线
cookbook_path "/Users/me/my-chef-repo/"
或者从命令行传入repo路径
knife upload roles -n -VV --chef-repo-path /Users/me/my-chef-repo/
我发现,那刀可以区分大小写:
https://tickets.opscode.com/browse/CHEF-4663
或"slash"-敏感:
基本上,我的 knife.rb 中有一个斜杠 (\),但我的 Windows 系统正在生成其他斜杠 (/),但它们不匹配。
对我来说,我将食谱文件夹放在导致问题的 ~/.chef 文件夹中。我通过将食谱文件夹向上移动一个目录并更新 ~/.chef/knife.rb.
中的路径来解决它
current_dir = File.dirname(__FILE__)
cookbook_path ["#{current_dir}/../cookbook_dir"]
当我尝试 运行 knife upload roles
或 knife upload /roles
时出现以下错误
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
我的knife.rb文件
cookbook_path "/Users/me/my-chef-repo"
如果 cookbook_path 在 knife.rb
中设置不正确,就会发生这种情况执行以下操作:
确保您的 knife.rb
中有尾部斜线cookbook_path "/Users/me/my-chef-repo/"
或者从命令行传入repo路径
knife upload roles -n -VV --chef-repo-path /Users/me/my-chef-repo/
我发现,那刀可以区分大小写:
https://tickets.opscode.com/browse/CHEF-4663
或"slash"-敏感:
基本上,我的 knife.rb 中有一个斜杠 (\),但我的 Windows 系统正在生成其他斜杠 (/),但它们不匹配。
对我来说,我将食谱文件夹放在导致问题的 ~/.chef 文件夹中。我通过将食谱文件夹向上移动一个目录并更新 ~/.chef/knife.rb.
中的路径来解决它current_dir = File.dirname(__FILE__)
cookbook_path ["#{current_dir}/../cookbook_dir"]