[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:08:44 UTC 2010


The following commit has been merged in the upstream branch:
commit 7f258059d8c16c2a20f48a28d636227cdb5a346b
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Thu Jan 7 16:35:41 2010 -0800

    Fix #1464 Mount complains about missing fields
    
    This family of errors could appear because Puppet parses every line in
    fstab into resources, even lines that are not specifically managed by
    Puppet, and fstab files are much more permissive than Puppet in what
    constitutes a valid mount.
    This change makes several fields optional that were previously mandatory.
    Also, it ignores lines in fstab that have fewer than the required number
    of parameters.
    
    Includes a more readable regex than the previous patch.
    
    Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>

diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb
index c660807..b30de2b 100755
--- a/lib/puppet/provider/mount/parsed.rb
+++ b/lib/puppet/provider/mount/parsed.rb
@@ -31,6 +31,15 @@ Puppet::Type.type(:mount).provide(:parsed,
     text_line :comment, :match => /^\s*#/
     text_line :blank, :match => /^\s*$/
 
-    record_line self.name, :fields => @fields, :separator => /\s+/, :joiner => "\t", :optional => [:pass, :dump]
+    optional_fields  = @fields - [:device, :name, :blockdevice]
+    mandatory_fields = @fields - optional_fields
+
+    # fstab will ignore lines that have fewer than the mandatory number of columns,
+    # so we should, too.
+    field_pattern = '(\s*(?>\S+))'
+    text_line :incomplete, :match => /^(?!#{field_pattern}{#{mandatory_fields.length}})/
+
+    record_line self.name, :fields => @fields, :separator => /\s+/, :joiner => "\t", :optional => optional_fields
+
 end
 
diff --git a/spec/unit/provider/mount/parsed.rb b/spec/unit/provider/mount/parsed.rb
index 10329e4..d394b29 100755
--- a/spec/unit/provider/mount/parsed.rb
+++ b/spec/unit/provider/mount/parsed.rb
@@ -108,6 +108,15 @@ describe provider_class do
                 end
             Puppet::Type.type(:mount).provider(:parsed).default_target.should == should
         end
+
+        it "should not crash on incomplete lines in fstab" do
+            parse = @provider_class.parse <<-FSTAB
+/dev/incomplete
+/dev/device       name
+            FSTAB
+
+            lambda{ @provider_class.to_line(parse[0]) }.should_not raise_error
+        end
     end
 
     describe provider_class, " when mounting an absent filesystem" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list