Fixing #725. I was apparently not deleting the alias I was creating to the components.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2718 980ebf18-57e1-0310-9a29-db15c13687c0
This commit is contained in:
Родитель
55014a263d
Коммит
3f1c865eab
|
@ -184,13 +184,22 @@ class Puppet::Type
|
|||
end
|
||||
|
||||
# remove a specified object
|
||||
def self.delete(object)
|
||||
def self.delete(resource)
|
||||
return unless defined? @objects
|
||||
if @objects.include?(object.title)
|
||||
@objects.delete(object.title)
|
||||
if @objects.include?(resource.title)
|
||||
@objects.delete(resource.title)
|
||||
end
|
||||
if @aliases.include?(object.title)
|
||||
@aliases.delete(object.title)
|
||||
if @aliases.include?(resource.title)
|
||||
@aliases.delete(resource.title)
|
||||
end
|
||||
if @aliases.has_value?(resource)
|
||||
names = []
|
||||
@aliases.each do |name, otherres|
|
||||
if otherres == resource
|
||||
names << name
|
||||
end
|
||||
end
|
||||
names.each { |name| @aliases.delete(name) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -89,6 +89,21 @@ class TestTypeInstances < Test::Unit::TestCase
|
|||
# Now make sure the resources have an 'ensure' property to go with the value in the provider
|
||||
assert(resources[:one].send(:instance_variable_get, "@parameters").include?(:ensure), "Did not create ensure property")
|
||||
end
|
||||
|
||||
# Make sure resources are entirely deleted.
|
||||
def test_delete
|
||||
aliases = %w{one}
|
||||
obj = @type.create(:name => "testing", :alias => "two")
|
||||
aliases << "two"
|
||||
|
||||
@type.alias("two", obj)
|
||||
|
||||
obj.remove
|
||||
assert_nil(@type["testing"], "Object was not removed from objects hash")
|
||||
assert_nil(@type["one"], "Object's alias was not removed")
|
||||
assert_nil(@type["two"], "Object's second alias was not removed")
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# $Id$
|
||||
|
|
Загрузка…
Ссылка в новой задаче