summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG6
-rw-r--r--lib/puppet/metatype/attributes.rb10
-rwxr-xr-xtest/rails/host.rb37
3 files changed, 9 insertions, 44 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8dad0d977..b5326a12f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
diff --git a/lib/puppet/metatype/attributes.rb b/lib/puppet/metatype/attributes.rb
index b83fcdd78..3f48f22ff 100644
--- a/lib/puppet/metatype/attributes.rb
+++ b/lib/puppet/metatype/attributes.rb
@@ -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
diff --git a/test/rails/host.rb b/test/rails/host.rb
index 582bebcb2..79f0ae398 100755
--- a/test/rails/host.rb
+++ b/test/rails/host.rb
@@ -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
-