[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08

James Turnbull james at lovedthanlost.net
Fri Jan 15 09:07:45 UTC 2010


The following commit has been merged in the upstream branch:
commit 4326eb2f875523d9e6d6b97cd962ac98661e9eb2
Author: Markus Roberts <Markus at reality.com>
Date:   Thu Dec 10 22:50:30 2009 -0800

    Fix for #2817 (links created even when links property set to follow)
    
    Commit 82714246b913087292f04190e03a885c99723f52 lost the distinction
    between links that were being followed and links that were being managed.
    This reinstated the distinction and (taking Luke up on his offer) also
    includes various cleanups.
    
    Signed-off-by: Markus Roberts <Markus at reality.com>

diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index 76c388e..7d5edcf 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -355,20 +355,12 @@ class Puppet::Property < Puppet::Parameter
     end
 
     def should_to_s(newvalue)
-        newvalue = [newvalue] unless newvalue.is_a? Array
-        if defined? newvalue
-            newvalue.join(" ")
-        else
-            return nil
-        end
+        [newvalue].flatten.join(" ")
     end
 
     def sync
-        if value = self.should
-            set(value)
-        else
-            self.devfail "Got a nil value for should"
-        end
+        devfail "Got a nil value for should" unless should
+        set(should)
     end
 
     def to_s
diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb
index f4236b4..c4b5fa1 100755
--- a/lib/puppet/type/file/ensure.rb
+++ b/lib/puppet/type/file/ensure.rb
@@ -80,13 +80,9 @@ module Puppet
 
 
         newvalue(:link) do
-            if property = @resource.property(:target)
-                property.retrieve
-
-                return property.mklink
-            else
-                self.fail "Cannot create a symlink without a target"
-            end
+            fail "Cannot create a symlink without a target" unless property = resource.property(:target)
+            property.retrieve
+            property.mklink
         end
 
         # Symlinks.
@@ -97,16 +93,9 @@ module Puppet
 
         munge do |value|
             value = super(value)
-
-            # It doesn't make sense to try to manage links unless, well,
-            # we're managing links.
-            resource[:links] = :manage if value == :link
-            return value if value.is_a? Symbol
-
-            @resource[:target] = value
-            resource[:links] = :manage
-
-            return :link
+            value,resource[:target] = :link,value unless value.is_a? Symbol
+            resource[:links] = :manage if value == :link and resource[:links] != :follow
+            value 
         end
 
         def change_to_s(currentvalue, newvalue)
diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb
index 39d9a20..838dabb 100755
--- a/lib/puppet/type/file/source.rb
+++ b/lib/puppet/type/file/source.rb
@@ -93,11 +93,7 @@ module Puppet
         end
 
         def checksum
-            if metadata
-                metadata.checksum
-            else
-                nil
-            end
+            metadata && metadata.checksum
         end
 
         # Look up (if necessary) and return remote content.
@@ -119,16 +115,20 @@ module Puppet
             [:owner, :mode, :group, :checksum].each do |param|
                 next if param == :owner and Puppet::Util::SUIDManager.uid != 0
                 next if param == :checksum and metadata.ftype == "directory"
-                unless value = @resource[param] and value != :absent
-                    @resource[param] = metadata.send(param)
+                unless value = resource[param] and value != :absent
+                    resource[param] = metadata.send(param)
                 end
             end
 
-            # Set the 'ensure' value, unless we're trying to delete the file.
-            @resource[:ensure] = metadata.ftype unless @resource[:ensure] == :absent
-
-            if metadata.ftype == "link"
-                @resource[:target] = metadata.destination
+            if resource[:ensure] == :absent 
+                # We know all we need to
+            elsif metadata.ftype != "link"
+                resource[:ensure] = metadata.ftype
+            elsif @resource[:links] == :follow
+                resource[:ensure] = :present
+            else
+                resource[:ensure] = "link"
+                resource[:target] = metadata.destination
             end
         end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list