diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-18 16:33:47 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-19 17:50:28 -0600 |
| commit | d3bc1e8279b6e1d372ab3624982788cde026461d (patch) | |
| tree | 549d4365b52e7aea1cddf7365368d34cdb980b93 /lib/puppet/file_serving/configuration | |
| parent | 00726bac02211be3c269c23a564bdcc8fdd28c2b (diff) | |
| download | puppet-d3bc1e8279b6e1d372ab3624982788cde026461d.tar.gz puppet-d3bc1e8279b6e1d372ab3624982788cde026461d.tar.xz puppet-d3bc1e8279b6e1d372ab3624982788cde026461d.zip | |
Adding pluginsyncing support to the Indirector
This switches away from the use of terminii for
each type of fileserving - it goes back to the traditional
fileserving method, and is much cleaner and simpler
as a result.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/file_serving/configuration')
| -rw-r--r-- | lib/puppet/file_serving/configuration/parser.rb | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb index cda6889d4..f36bef639 100644 --- a/lib/puppet/file_serving/configuration/parser.rb +++ b/lib/puppet/file_serving/configuration/parser.rb @@ -46,20 +46,15 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile } } + mk_default_mounts + + validate() + return @mounts end private - # Add the mount for getting files from modules. - def add_module_mount - unless @mounts[MODULES] - mount = Mount.new(MODULES) - mount.allow("*") - @mounts[MODULES] = mount - end - end - # Allow a given pattern access to a mount. def allow(mount, value) # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] @@ -88,39 +83,47 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile } end + def mk_default_mounts + ["plugins", "modules"].each do |name| + newmount(name) unless @mounts[name] + end + end + # Create a new mount. def newmount(name) if @mounts.include?(name) raise ArgumentError, "%s is already mounted at %s" % [@mounts[name], name], @count, file end - mount = Mount.new(name) + case name + when "modules" + mount = Mount::Modules.new(name) + when "plugins" + mount = Mount::Plugins.new(name) + else + mount = Mount::File.new(name) + end @mounts[name] = mount return mount end # Set the path for a mount. def path(mount, value) - if mount.name == MODULES - Puppet.warning "The '#{MODULES}' module can not have a path. Ignoring attempt to set it" - else + if mount.respond_to?(:path=) begin mount.path = value rescue ArgumentError => detail - Puppet.err "Removing mount %s: %s" % - [mount.name, detail] + Puppet.err "Removing mount %s: %s" % [mount.name, detail] @mounts.delete(mount.name) end + else + Puppet.warning "The '#{mount.name}' module can not have a path. Ignoring attempt to set it" end end # Make sure all of our mounts are valid. We have to do this after the fact # because details are added over time as the file is parsed. def validate - @mounts.each { |name, mount| - unless mount.valid? - raise ArgumentError, "No path specified for mount %s" % name - end - } + @mounts.each { |name, mount| mount.validate } end end |
