From 3aff4a0e9debfe22bd2a4b024b89410f481d09f7 Mon Sep 17 00:00:00 2001 From: luke Date: Mon, 29 Jan 2007 00:47:56 +0000 Subject: Doing more work on #113. Mostly, just making sure remounts do not happen spuriously very often. They will still have extra remounts when changing the value of "ensure", but that is not currently avoidable (similar to #199). git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2109 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/log.rb | 4 +++- lib/puppet/parameter.rb | 9 --------- lib/puppet/provider/mount.rb | 7 ++++++- lib/puppet/transaction.rb | 10 ++++++---- lib/puppet/type/mount.rb | 12 ++++++++---- 5 files changed, 23 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index 53535e90c..44b4352ce 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -517,7 +517,9 @@ module Puppet # we retrieve any tags we can. def source=(source) # We can't store the actual source, we just store the path. - if source.respond_to?(:path) + # We can't just check for whether it responds to :path, because + # plenty of providers respond to that in their normal function. + if source.is_a?(Puppet::Element) and source.respond_to?(:path) @objectsource = true @source = source.path else diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb index 78ee4ddf1..e480a06bd 100644 --- a/lib/puppet/parameter.rb +++ b/lib/puppet/parameter.rb @@ -285,15 +285,6 @@ module Puppet return tmp end - # return the full path to us, for logging and rollback; not currently - # used - def path - unless defined? @path - @path = pathbuilder - end - return @path.join("/") - end - # return the full path to us, for logging and rollback; not currently # used def pathbuilder diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index bd8693e7d..103d1da0e 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -14,7 +14,12 @@ module Puppet::Provider::Mount def remount info "Remounting" if @model[:remounts] == :true - mountcmd "-o", "remount", @model[:name] + if Facter.value(:operatingsystem) == "FreeBSD" + # Thanks FreeBSD + mountcmd @model[:name] + else + mountcmd "-o", "remount", @model[:name] + end else unmount() mount() diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index f3662ccfe..2240ca19f 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -84,10 +84,12 @@ class Transaction resource.flush end - # And set a trigger for refreshing this resource if it's a self-refresher - if resource.self_refresh? - # Create an edge with this resource as both the source and target. The triggering - # method treats these specially for logging. + # And set a trigger for refreshing this resource if it's a + # self-refresher + if resource.self_refresh? and ! resource.deleting? + # Create an edge with this resource as both the source and + # target. The triggering method treats these specially for + # logging. set_trigger(Puppet::Relationship.new(resource, resource, :callback => :refresh, :event => :ALL_EVENTS)) end end diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index 4961e689a..df0beca6f 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -155,13 +155,14 @@ module Puppet end newparam(:remounts) do - desc "Whether the mount can be remounted ``mount -o remount``. If this is false, - then the filesystem will be unmounted and remounted manually, which is prone to failure." + desc "Whether the mount can be remounted ``mount -o remount``. If + this is false, then the filesystem will be unmounted and remounted + manually, which is prone to failure." newvalues(:true, :false) defaultto do case Facter.value(:operatingsystem) - when "Darwin": false + when "Darwin", "FreeBSD": false else true end @@ -173,7 +174,10 @@ module Puppet on the value of the 'ensure' parameter." def refresh - provider.remount + # Only remount if we're supposed to be mounted. + if ens = @states[:ensure] and ens.should == :mounted + provider.remount + end end def value(name) -- cgit