diff options
author | tyler-ball <tyleraball@gmail.com> | 2014-12-11 15:14:58 -0800 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2014-12-16 17:59:33 -0800 |
commit | f0e75a337daa62608b9e816ef8bdc2335bf2b033 (patch) | |
tree | de2b7df214b45d6fe05987f8da5923018e2a739b /lib/chef/resource_collection | |
parent | 1d5b9bf57df6812b6f6a2961d0995aa6c2d8f695 (diff) | |
download | chef-f0e75a337daa62608b9e816ef8bdc2335bf2b033.tar.gz |
First pass at fixing broken notifications
Fixing some code I changed unecessarily
Removing TODOs which are not necessary
Diffstat (limited to 'lib/chef/resource_collection')
-rw-r--r-- | lib/chef/resource_collection/resource_set.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb index 6425c2ab08..1b39298cb4 100644 --- a/lib/chef/resource_collection/resource_set.rb +++ b/lib/chef/resource_collection/resource_set.rb @@ -44,7 +44,7 @@ class Chef is_chef_resource!(resource) resource_type ||= resource.resource_name instance_name ||= resource.name - key = ResourceSet.create_key(resource_type, instance_name) + key = create_key(resource_type, instance_name) @resources_by_key[key] = resource end @@ -53,7 +53,7 @@ class Chef when key.kind_of?(String) lookup_by = key when key.kind_of?(Chef::Resource) - lookup_by = ResourceSet.create_key(key.resource_name, key.name) + lookup_by = create_key(key.resource_name, key.name) else raise ArgumentError, "Must pass a Chef::Resource or String to lookup" end @@ -128,18 +128,18 @@ class Chef end end - def self.create_key(resource_type, instance_name) + private + + def create_key(resource_type, instance_name) "#{resource_type}[#{instance_name}]" end - private - def find_resource_by_hash(arg) results = Array.new arg.each do |resource_type, name_list| instance_names = name_list.kind_of?(Array) ? name_list : [ name_list ] instance_names.each do |instance_name| - results << lookup(ResourceSet.create_key(resource_type, instance_name)) + results << lookup(create_key(resource_type, instance_name)) end end return results @@ -153,12 +153,12 @@ class Chef arg =~ /^.+\[(.+)\]$/ resource_list = $1 resource_list.split(",").each do |instance_name| - results << lookup(ResourceSet.create_key(resource_type, instance_name)) + results << lookup(create_key(resource_type, instance_name)) end when SINGLE_RESOURCE_MATCH resource_type = $1 name = $2 - results << lookup(ResourceSet.create_key(resource_type, name)) + results << lookup(create_key(resource_type, name)) else raise ArgumentError, "Bad string format #{arg}, you must have a string like resource_type[name]!" end |