Class: Chef::Knife::Diff
- Inherits:
-
ChefFS::Knife
- Object
- Chef::Knife
- ChefFS::Knife
- Chef::Knife::Diff
- Defined in:
- lib/chef/knife/diff.rb
Instance Method Summary collapse
Methods inherited from ChefFS::Knife
#chef_fs, #configure_chef, #create_chef_fs, #create_local_fs, deps, #discover_repo_dir, #format_path, inherited, #local_fs, #parallelize, #pattern_arg_from, #pattern_args, #pattern_args_from
Instance Method Details
#run ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/chef/knife/diff.rb', line 54 def run if config[:name_only] output_mode = :name_only end if config[:name_status] output_mode = :name_status end patterns = pattern_args_from(name_args.length > 0 ? name_args : [ "" ]) # Get the matches (recursively) error = false begin patterns.each do |pattern| found_error = Chef::ChefFS::CommandLine.diff_print(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode, proc { |entry| format_path(entry) }, config[:diff_filter], ui ) do |diff| stdout.print diff end error = true if found_error end rescue Chef::ChefFS::FileSystem::OperationFailedError => e ui.error "Failed on #{format_path(e.entry)} in #{e.operation}: #{e.message}" error = true end if error exit 1 end end |