summaryrefslogtreecommitdiffstats
path: root/lib/puppet/file_serving/configuration
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2011-05-30 20:31:14 +0200
committerJacob Helwig <jacob@puppetlabs.com>2011-07-26 14:04:28 -0700
commit6401dfe5602fd39cc59ec1f1b3822110e4ad864a (patch)
treeccea4f33b572c998cd4770feab3e6959f354b7eb /lib/puppet/file_serving/configuration
parent0c385f1fb436ab6f667693d347f711470305a019 (diff)
downloadpuppet-6401dfe5602fd39cc59ec1f1b3822110e4ad864a.tar.gz
puppet-6401dfe5602fd39cc59ec1f1b3822110e4ad864a.tar.xz
puppet-6401dfe5602fd39cc59ec1f1b3822110e4ad864a.zip
Fix #6026 - security file should support inline comments
Auth.conf, namespaceauth.conf and fileserver.conf were not supporting trailing inlined comments. Also this commit fixes some indentation and error management. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/file_serving/configuration')
-rw-r--r--lib/puppet/file_serving/configuration/parser.rb19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb
index 334201d37..83b75e28f 100644
--- a/lib/puppet/file_serving/configuration/parser.rb
+++ b/lib/puppet/file_serving/configuration/parser.rb
@@ -24,9 +24,10 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
when /^\s*$/; next # skip blank lines
when /\[([-\w]+)\]/
mount = newmount($1)
- when /^\s*(\w+)\s+(.+)$/
+ when /^\s*(\w+)\s+(.+?)(\s*#.*)?$/
var = $1
value = $2
+ value.strip!
raise(ArgumentError, "Fileserver configuration file does not use '=' as a separator") if value =~ /^=/
case var
when "path"
@@ -58,12 +59,8 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
begin
mount.info "allowing #{val} access"
mount.allow(val)
- rescue AuthStoreError => detail
-
- raise ArgumentError.new(
- detail.to_s,
-
- @count, file)
+ rescue Puppet::AuthStoreError => detail
+ raise ArgumentError.new(detail.to_s, @count, file)
end
}
end
@@ -75,12 +72,8 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
begin
mount.info "denying #{val} access"
mount.deny(val)
- rescue AuthStoreError => detail
-
- raise ArgumentError.new(
- detail.to_s,
-
- @count, file)
+ rescue Puppet::AuthStoreError => detail
+ raise ArgumentError.new(detail.to_s, @count, file)
end
}
end