5c1c536015ea3e87acc19653faf537c0fb22b7ba

Author
Ben Hartshorne <ben@parse.com>
Committer
Ben Hartshorne <ben@parse.com>
Date

Message

allowing you to override knife paths

Diff

 1diff --git a/plugins/knife/_knife b/plugins/knife/_knife
 2index dec49125786e5dd40b04d092f540cc07e2ce57b3..ca634795721a47917fdf58fdecf0547cd7d7c10b 100644
 3--- a/plugins/knife/_knife
 4+++ b/plugins/knife/_knife
 5@@ -170,11 +170,13 @@ _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- local knife_rb="$HOME/.chef/knife.rb"
10- if [ -f ./.chef/knife.rb ]; then
11-  knife_rb="./.chef/knife.rb"
12- fi
13- (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)
14+  
15+  local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
16+  if [ -f ./.chef/knife.rb ]; then
17+    knife_rb="./.chef/knife.rb"
18+  fi
19+  local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
20+  (for i in $cookbook_path; do ls $i; done)
21 }
22 
23 # This function extracts the available cookbook versions on the chef server