diff options
author | John Keiser <jkeiser@opscode.com> | 2013-06-03 13:46:36 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:36 -0700 |
commit | a9aad0c40c92cc1427ebb577817c23f180a9dba2 (patch) | |
tree | a13b1e2e83674133c61f6601b4d9df79e4e3852d /lib/chef/knife/delete.rb | |
parent | e8595bdec6aa35820c17669c8dbcb5265303ef1f (diff) | |
download | chef-a9aad0c40c92cc1427ebb577817c23f180a9dba2.tar.gz |
Make knife delete only delete remote copy instead of both remote and local by default
Diffstat (limited to 'lib/chef/knife/delete.rb')
-rw-r--r-- | lib/chef/knife/delete.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/chef/knife/delete.rb b/lib/chef/knife/delete.rb index 344d3bed97..fb26b9ea35 100644 --- a/lib/chef/knife/delete.rb +++ b/lib/chef/knife/delete.rb @@ -15,16 +15,16 @@ class Chef :boolean => true, :default => false, :description => "Delete directories recursively." - option :remote_only, - :long => '--remote-only', + option :both, + :long => '--both', :boolean => true, :default => false, - :description => "Only delete the remote copy (leave the local copy)." - option :local_only, - :long => '--local-only', + :description => "Delete both the local and remote copies." + option :local, + :long => '--local', :boolean => true, :default => false, - :description => "Only delete the local copy (leave the remote copy)." + :description => "Delete the local copy (leave the remote copy)." def run if name_args.length == 0 @@ -35,26 +35,26 @@ class Chef # Get the matches (recursively) error = false - if config[:remote_only] + if config[:local] pattern_args.each do |pattern| - Chef::ChefFS::FileSystem.list(chef_fs, pattern).each do |result| + Chef::ChefFS::FileSystem.list(local_fs, pattern).each do |result| if delete_result(result) error = true end end end - elsif config[:local_only] + elsif config[:both] pattern_args.each do |pattern| - Chef::ChefFS::FileSystem.list(local_fs, pattern).each do |result| - if delete_result(result) + Chef::ChefFS::FileSystem.list_pairs(pattern, chef_fs, local_fs).each do |chef_result, local_result| + if delete_result(chef_result, local_result) error = true end end end - else + else # Remote only pattern_args.each do |pattern| - Chef::ChefFS::FileSystem.list_pairs(pattern, chef_fs, local_fs).each do |chef_result, local_result| - if delete_result(chef_result, local_result) + Chef::ChefFS::FileSystem.list(chef_fs, pattern).each do |result| + if delete_result(result) error = true end end |