1ced49b85a859b399728ce32ef77399874f5172b

Author
Cameron Johnston <cwjohnston@gmail.com>
Committer
Cameron Johnston <cwjohnston@gmail.com>
Date

Message

adding support for chef environments in knife plugin

Diff

 1diff --git a/plugins/knife/_knife b/plugins/knife/_knife
 2index 7f8c95ee5a470810785cb719828371a5e7463e6c..32ff9fc99262a8fb6eb4536121a32a4eb3e2b53a 100644
 3--- a/plugins/knife/_knife
 4+++ b/plugins/knife/_knife
 5@@ -26,7 +26,7 @@ _knife() {
 6   
 7   case $state in
 8   knifecmd)
 9-    compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders
10+    compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
11   ;;
12   knifesubcmd)
13     case $words[2] in
14@@ -42,6 +42,9 @@ _knife() {
15     cookbook)
16       compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
17     ;;
18+  environment)
19+      compadd -Q "$@" list create delete edit show "from file"
20+      ;;
21     node)
22      compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
23     ;;
24@@ -161,6 +164,10 @@ _chef_data_bags_remote() {
25  (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
26 }
27 
28+_chef_environments_remote() {
29+  (knife environment list | awk '{print $1}')
30+}
31+
32 # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
33 _chef_cookbooks_local() {
34  (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)