summaryrefslogtreecommitdiff
path: root/lib/chef/knife/deps.rb
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2013-01-03 17:51:07 -0800
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:15 -0700
commit233f984d7a68a87ba3c9d9871929bb32d18f5256 (patch)
treed2bd991903237b044ebd0fdd4d7b9b505c017f42 /lib/chef/knife/deps.rb
parentced1223a8fb561139add8e0221c32b837d801200 (diff)
downloadchef-233f984d7a68a87ba3c9d9871929bb32d18f5256.tar.gz
Fix deps errors, --no-recurse, add deps tests
Diffstat (limited to 'lib/chef/knife/deps.rb')
-rw-r--r--lib/chef/knife/deps.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index dc4ddaa40a..5217564a08 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -22,8 +22,8 @@ class Chef
:description => "List dependencies on the server instead of the local filesystem"
def run
- if config[:tree] && config[:recurse]
- ui.error "--recurse requires --tree"
+ if config[:recurse] == false && !config[:tree]
+ ui.error "--no-recurse requires --tree"
exit(1)
end
config[:recurse] = true if config[:recurse].nil?
@@ -55,7 +55,7 @@ class Chef
def print_dependencies_tree(entry, dependencies, printed = {}, depth = 0)
dependencies[entry.path] = get_dependencies(entry) if !dependencies[entry.path]
output "#{' '*depth}#{format_path(entry.path)}"
- if !printed[entry.path] && (config[:recurse] || depth <= 1)
+ if !printed[entry.path] && (config[:recurse] || depth == 0)
printed[entry.path] = true
dependencies[entry.path].each do |child|
child_entry = Chef::ChefFS::FileSystem.resolve_path(@root, child)
@@ -68,11 +68,11 @@ class Chef
begin
object = entry.chef_object
rescue Chef::ChefFS::FileSystem::NotFoundError
- ui.error "#{result.path_for_printing}: No such file or directory"
+ ui.error "#{format_path(entry.path)}: No such file or directory"
return []
end
if !object
- ui.error "#{entry} is not a Chef object!"
+ ui.error "#{format_path(entry.path)} is not a Chef object!"
return []
end