diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-31 22:47:01 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-31 22:47:01 +0000 |
| commit | d467e18bc66b124dc4950cb4442d0d67ed4c573f (patch) | |
| tree | 934a1371439b929065e78541093981538fcf914c | |
| parent | e8097a2fc1318829b31b4cb3e4b076db30696ef7 (diff) | |
| download | puppet-d467e18bc66b124dc4950cb4442d0d67ed4c573f.tar.gz puppet-d467e18bc66b124dc4950cb4442d0d67ed4c573f.tar.xz puppet-d467e18bc66b124dc4950cb4442d0d67ed4c573f.zip | |
Fixing #532 -- reparsing config files no longer throws an exception. The problem only occurred when reparsing a configuration file that was also being managed (which was common) and only whent the manifest was up to date (the combination was uncommon). Reparsing would find the existing file object and use it to check permissions and such, then it would remove all of the internal data in the object, for cleanup; the problem is, the client still had a reference to the object, so when it went to run its configuration, this broken reference was used.
The solution I chose was to remove all objects from memory after every run. It is negligible to reload them from the cache, and it saves ram for the 99% of the time that the client is just sitting there. And it makes this problem go away. :)
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2545 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | CHANGELOG | 2 | ||||
| -rw-r--r-- | lib/puppet/network/client/master.rb | 3 | ||||
| -rwxr-xr-x | test/network/client/master.rb | 17 |
3 files changed, 21 insertions, 1 deletions
@@ -1,3 +1,5 @@ + Fixed #532 -- reparsing config files now longer throws an exception. + Added some warnings and logs to the service type so users will be encouraged to specify either "ensure" or "enabled" and added debugging to indicate why diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index 2b9490539..ae13f8185 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -108,7 +108,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end def clear - @objects.remove(true) + @objects.remove(true) if @objects Puppet::Type.allclear mkdefault_objects @objects = nil @@ -325,6 +325,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client ensure # Just make sure we remove the lock file if we set it. lockfile.unlock if got_lock and lockfile.locked? + clear() end def running? diff --git a/test/network/client/master.rb b/test/network/client/master.rb index edd91cf30..64ff34314 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -706,6 +706,23 @@ end client.send(:splay) end end + + # This is partially to fix #532, but also to save on memory. + def test_remove_objects_after_every_run + client = mkclient + + ftype = Puppet::Type.type(:file) + + assert_nil(ftype[@createdfile], "file object already exists") + assert(! FileTest.exists?(@createdfile), "File already exists on disk") + + assert_nothing_raised("Could not apply config") do + client.run + end + + assert(FileTest.exists?(@createdfile), "File does not exist on disk") + assert_nil(ftype[@createdfile], "file object was not removed from memory") + end end # $Id$ |
