summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2014-08-22 07:31:05 -0700
committerJohn Keiser <jkeiser@opscode.com>2014-08-22 09:20:51 -0700
commit8e713188410f66da32244aaf1fc44e22c8f721c2 (patch)
tree8dab47fb86b0f1a4d0687b84c231da776e6689d6 /lib
parent1d318354a276e64742f8aa889a6ab1adedbfe351 (diff)
downloadchef-zero-8e713188410f66da32244aaf1fc44e22c8f721c2.tar.gz
Get rspec data working again for creatorless data
Diffstat (limited to 'lib')
-rw-r--r--lib/chef_zero/chef_data/default_creator.rb2
-rw-r--r--lib/chef_zero/data_store/default_facade.rb8
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef_zero/chef_data/default_creator.rb b/lib/chef_zero/chef_data/default_creator.rb
index 49bb542..eecc213 100644
--- a/lib/chef_zero/chef_data/default_creator.rb
+++ b/lib/chef_zero/chef_data/default_creator.rb
@@ -60,7 +60,7 @@ module ChefZero
# Walk up the tree, setting the creator on anything that doesn't exist
# (anything that is either deleted or was never created)
while (deleted_index && path.size > deleted_index) || !@creators[path]
- @creators[path] = [ creator ]
+ @creators[path] = creator ? [ creator ] : []
@deleted.delete(path)
# Only do this once if create_parents is false
break if !create_parents || path.size == 0
diff --git a/lib/chef_zero/data_store/default_facade.rb b/lib/chef_zero/data_store/default_facade.rb
index c274102..c0e33b9 100644
--- a/lib/chef_zero/data_store/default_facade.rb
+++ b/lib/chef_zero/data_store/default_facade.rb
@@ -61,7 +61,7 @@ module ChefZero
end
end
- options_hash = options.last || {}
+ options_hash = options.last.is_a?(Hash) ? options.last : {}
default_creator.created(path + [ name ], options_hash[:requestor], options.include?(:recursive))
end
@@ -82,7 +82,9 @@ module ChefZero
begin
real_store.set(path, data, *options)
rescue DataNotFoundError
- if default_creator.exists?(path)
+ if options.include?(:create_dir) ||
+ options.include?(:create) && default_creator.exists?(path[0..-2]) ||
+ default_creator.exists?(path)
real_store.set(path, data, :create, :create_dir, *options)
else
raise
@@ -90,7 +92,7 @@ module ChefZero
end
if options.include?(:create)
- options_hash = options.last || {}
+ options_hash = options.last.is_a?(Hash) ? options.last : {}
default_creator.created(path, options_hash[:requestor], options.include?(:create_dir))
end
end