Resources now return the 'should' value for properties from

the [] accessor method (they previously threw an exception when
this method was used with properties).  This shouldn't have any
affect functionally; it just makes the method equivalent to 'should'
for properties, but it works for all attribute types now.
This commit is contained in:
Luke Kanies 2008-04-11 13:01:17 -05:00
Родитель 4aaad26509
Коммит b49fd49562
3 изменённых файлов: 9 добавлений и 44 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Resources now return the 'should' value for properties from
the [] accessor method (they previously threw an exception when
this method was used with properties). This shouldn't have any
affect functionally; it just makes the method equivalent to 'should'
for properties, but it works for all attribute types now.
Modified the 'master' handler to use the Catalog class to
compile node configurations, rather than using the Configuration
handler, which was never used directly. I removed the Configuration

Просмотреть файл

@ -477,13 +477,9 @@ class Puppet::Type
end
if obj = @parameters[name]
# We throw a failure here, because this method is too
# ambiguous when used with properties.
if obj.is_a?(Puppet::Property)
fail "[] called on a property"
else
return obj.value
end
# Note that if this is a property, then the value is the "should" value,
# not the current value.
obj.value
else
return nil
end

Просмотреть файл

@ -151,41 +151,4 @@ class TestRailsHost < PuppetTest::TestCase
"loglevel was not added")
end
end
def test_freshness_connect_update
Puppet::Rails.init
Puppet[:storeconfigs] = true
Puppet[:code] = " "
# this is the default server setup
master = Puppet::Network::Handler.configuration.new(
:Local => true
)
# Create a host
Puppet::Rails::Host.new(:name => "test", :ip => "192.168.0.3").save
assert_nothing_raised("Failed to update last_connect for unknown host") do
master.version("created",'192.168.0.1')
end
# Make sure it created the host
created = Puppet::Rails::Host.find_by_name("created")
assert(created, "Freshness did not create host")
assert(created.last_freshcheck,
"Did not set last_freshcheck on created host")
# Now check on the existing host
assert_nothing_raised("Failed to update last_connect for unknown host") do
master.version("test",'192.168.0.2')
end
# Recreate it, so we're not using the cached object.
host = Puppet::Rails::Host.find_by_name("test")
# Make sure it created the host
assert(host.last_freshcheck,
"Did not set last_freshcheck on existing host")
end
end