Add support for chef environments in knife plugin
Robby Russell authored on 19/12/2011 at 21:55:40... | ... |
@@ -26,7 +26,7 @@ _knife() { |
26 | 26 |
|
27 | 27 |
case $state in |
28 | 28 |
knifecmd) |
29 |
- compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders |
|
29 |
+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders |
|
30 | 30 |
;; |
31 | 31 |
knifesubcmd) |
32 | 32 |
case $words[2] in |
... | ... |
@@ -42,6 +42,9 @@ _knife() { |
42 | 42 |
cookbook) |
43 | 43 |
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload |
44 | 44 |
;; |
45 |
+ environment) |
|
46 |
+ compadd -Q "$@" list create delete edit show "from file" |
|
47 |
+ ;; |
|
45 | 48 |
node) |
46 | 49 |
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" |
47 | 50 |
;; |
... | ... |
@@ -161,6 +164,10 @@ _chef_data_bags_remote() { |
161 | 161 |
(knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
162 | 162 |
} |
163 | 163 |
|
164 |
+_chef_environments_remote() { |
|
165 |
+ (knife environment list | awk '{print $1}') |
|
166 |
+} |
|
167 |
+ |
|
164 | 168 |
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server |
165 | 169 |
_chef_cookbooks_local() { |
166 | 170 |
(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) |