[prev in list] [next in list] [prev in thread] [next in thread]
List: puppet-commit
Subject: [Puppet-commit] puppet revision 1986
From: svn () madstop ! com
Date: 2006-12-29 5:03:07
Message-ID: 20061229050307.8033D16F117 () culain ! madstop ! com
[Download RAW message or body]
luke 2006-12-28 23:03:07 -0600 (Thu, 28 Dec 2006)
Adding a bit more testing to mounts, and pulling a bit of the transaction into a \
separate method to shorten the apply() method.
Modified: trunk/lib/puppet/transaction.rb
===================================================================
--- trunk/lib/puppet/transaction.rb 2006-12-29 04:53:48 UTC (rev 1985)
+++ trunk/lib/puppet/transaction.rb 2006-12-29 05:03:07 UTC (rev 1986)
@@ -67,7 +67,24 @@
@resourcemetrics[:out_of_sync] += 1
end
- resourceevents = changes.collect { |change|
+ resourceevents = apply_changes(resource, changes)
+
+ unless changes.empty?
+ # Record when we last synced
+ resource.cache(:synced, Time.now)
+
+ # Flush, if appropriate
+ if resource.respond_to?(:flush)
+ resource.flush
+ end
+ end
+
+ resourceevents
+ end
+
+ # Apply each change in turn.
+ def apply_changes(resource, changes)
+ changes.collect { |change|
@changes << change
@count += 1
change.transaction = self
@@ -99,18 +116,6 @@
events
}.flatten.reject { |e| e.nil? }
-
- unless changes.empty?
- # Record when we last synced
- resource.cache(:synced, Time.now)
-
- # Flush, if appropriate
- if resource.respond_to?(:flush)
- resource.flush
- end
- end
-
- resourceevents
end
# Find all of the changed resources.
Modified: trunk/test/providers/mount/parsed.rb
===================================================================
--- trunk/test/providers/mount/parsed.rb 2006-12-29 04:53:48 UTC (rev 1985)
+++ trunk/test/providers/mount/parsed.rb 2006-12-29 05:03:07 UTC (rev 1986)
@@ -105,6 +105,13 @@
# the isomorphic methods.
assert(@provider.target_object(target).read.include?("\t%s\t" %
mount.state_hash[:name]), "Mount was not written to disk")
+
+ # now make a change
+ assert_nothing_raised { mount.dump = 5 }
+ assert_nothing_raised { mount.flush }
+
+ @provider.prefetch
+ assert_equal(5, mount.dump, "did not flush change to disk")
end
unless Facter["operatingsystem"].value == "Darwin"
[Attachment #3 (text/html)]
<p><b>luke</b> 2006-12-28 23:03:07 -0600 (Thu, 28 Dec 2006)</p><p>Adding a bit more \
testing to mounts, and pulling a bit of the transaction into a separate method to \
shorten the apply() method.<br> </p><hr noshade><pre><font color="gray">Modified: \
trunk/lib/puppet/transaction.rb \
===================================================================
--- trunk/lib/puppet/transaction.rb 2006-12-29 04:53:48 UTC (rev 1985)
+++ trunk/lib/puppet/transaction.rb 2006-12-29 05:03:07 UTC (rev 1986)
@@ -67,7 +67,24 @@
@resourcemetrics[:out_of_sync] += 1
end
- resourceevents = changes.collect { |change|
+ resourceevents = apply_changes(resource, changes)
+
+ unless changes.empty?
+ # Record when we last synced
+ resource.cache(:synced, Time.now)
+
+ # Flush, if appropriate
+ if resource.respond_to?(:flush)
+ resource.flush
+ end
+ end
+
+ resourceevents
+ end
+
+ # Apply each change in turn.
+ def apply_changes(resource, changes)
+ changes.collect { |change|
@changes << change
@count += 1
change.transaction = self
@@ -99,18 +116,6 @@
events
}.flatten.reject { |e| e.nil? }
-
- unless changes.empty?
- # Record when we last synced
- resource.cache(:synced, Time.now)
-
- # Flush, if appropriate
- if resource.respond_to?(:flush)
- resource.flush
- end
- end
-
- resourceevents
end
# Find all of the changed resources.
Modified: trunk/test/providers/mount/parsed.rb
===================================================================
--- trunk/test/providers/mount/parsed.rb 2006-12-29 04:53:48 UTC (rev 1985)
+++ trunk/test/providers/mount/parsed.rb 2006-12-29 05:03:07 UTC (rev 1986)
@@ -105,6 +105,13 @@
# the isomorphic methods.
assert(@provider.target_object(target).read.include?("\t%s\t" %
mount.state_hash[:name]), "Mount was not written to disk")
+
+ # now make a change
+ assert_nothing_raised { mount.dump = 5 }
+ assert_nothing_raised { mount.flush }
+
+ @provider.prefetch
+ assert_equal(5, mount.dump, "did not flush change to disk")
end
unless Facter["operatingsystem"].value == "Darwin"
</font>
</pre>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic