summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-05-28 10:22:47 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:35 -0700
commitf8ba656b8fb1d464d8c17cd29fd54cf41aa76c5b (patch)
tree00ea25d847500349da2fbd27424e569f716ed91c
parent1af736eb3213be0feef1097adaeafac0155ba090 (diff)
downloadchef-f8ba656b8fb1d464d8c17cd29fd54cf41aa76c5b.tar.gz
Fix cookbook upload in knife serve
-rw-r--r--lib/chef/chef_fs/file_system.rb10
-rw-r--r--lib/chef/chef_fs/file_system/memory_dir.rb2
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb
index 2c50d9537e..3c48fbd9db 100644
--- a/lib/chef/chef_fs/file_system.rb
+++ b/lib/chef/chef_fs/file_system.rb
@@ -276,8 +276,8 @@ class Chef
error = false
begin
- dest_path = format_path.call(dest_entry)
- src_path = format_path.call(src_entry)
+ dest_path = format_path.call(dest_entry) if ui
+ src_path = format_path.call(src_entry) if ui
if !src_entry.exists?
if options[:purge]
# If we would not have uploaded it, we will not purge it.
@@ -406,13 +406,13 @@ class Chef
def self.get_or_create_parent(entry, options, ui, format_path)
parent = entry.parent
if parent && !parent.exists?
- parent_path = format_path.call(parent)
+ parent_path = format_path.call(parent) if ui
parent_parent = get_or_create_parent(entry.parent, options, ui, format_path)
if options[:dry_run]
- ui.output "Would create #{parent_path}"
+ ui.output "Would create #{parent_path}" if ui
else
parent = parent_parent.create_child(parent.name, nil)
- ui.output "Created #{parent_path}"
+ ui.output "Created #{parent_path}" if ui
end
end
return parent
diff --git a/lib/chef/chef_fs/file_system/memory_dir.rb b/lib/chef/chef_fs/file_system/memory_dir.rb
index 91a4c7aa64..a7eda3c654 100644
--- a/lib/chef/chef_fs/file_system/memory_dir.rb
+++ b/lib/chef/chef_fs/file_system/memory_dir.rb
@@ -28,7 +28,7 @@ class Chef
def add_file(path, value)
path_parts = path.split('/')
dir = add_dir(path_parts[0..-2].join('/'))
- file = MemoryFile.new(path_parts[0], dir, value)
+ file = MemoryFile.new(path_parts[-1], dir, value)
dir.add_child(file)
file
end