Merge pull request #1233 from mugenken/knife-check-cwd
check for knife.rb in cwd
Diff
1diff --git a/plugins/knife/_knife b/plugins/knife/_knife
2index 8453af5be60abb5412a28010dc500f7fb1512cc9..dec49125786e5dd40b04d092f540cc07e2ce57b3 100644
3--- a/plugins/knife/_knife
4+++ b/plugins/knife/_knife
5@@ -170,7 +170,11 @@ _chef_environments_remote() {
6 7 # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
8 _chef_cookbooks_local() {
9- (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
10+ local knife_rb="$HOME/.chef/knife.rb"
11+ if [ -f ./.chef/knife.rb ]; then
12+ knife_rb="./.chef/knife.rb"
13+ fi
14+ (for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
15 }
1617 # This function extracts the available cookbook versions on the chef server