summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-01-07 16:35:41 -0800
committerJames Turnbull <james@lovedthanlost.net>2010-01-12 10:32:45 +1100
commit7f258059d8c16c2a20f48a28d636227cdb5a346b (patch)
treee990eb54322430d55c5d81964c661384c99c522f /lib
parentc99f394bf8c10d13f3fa7d3ab7ab43ecf454c081 (diff)
downloadpuppet-7f258059d8c16c2a20f48a28d636227cdb5a346b.tar.gz
puppet-7f258059d8c16c2a20f48a28d636227cdb5a346b.tar.xz
puppet-7f258059d8c16c2a20f48a28d636227cdb5a346b.zip
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@gmail.com>
Diffstat (limited to 'lib')
-rwxr-xr-xlib/puppet/provider/mount/parsed.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb
index c660807ce..b30de2bc7 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