summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-03-05 17:13:17 -0600
committerLuke Kanies <luke@madstop.com>2009-03-05 17:13:17 -0600
commit71e4919f6b60b36b9ba0b02d3619c0fb5e4df445 (patch)
treee616c169ef7b1909d20ab92624fb5d8857c1adfb /lib
parent09bee9137d7a6415609a8abfdf727ee0361139e0 (diff)
downloadpuppet-71e4919f6b60b36b9ba0b02d3619c0fb5e4df445.tar.gz
puppet-71e4919f6b60b36b9ba0b02d3619c0fb5e4df445.tar.xz
puppet-71e4919f6b60b36b9ba0b02d3619c0fb5e4df445.zip
Moving default fileserving mount creation to the Configuration class
It was previously in the parser, but the parser is only created if the fileserver.conf exists, so the default mounts weren't made if the file didn't exist. This is a bit less encapsulation, but not much. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/file_serving/configuration.rb9
-rw-r--r--lib/puppet/file_serving/configuration/parser.rb8
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb
index 608924c8b..6092c24e2 100644
--- a/lib/puppet/file_serving/configuration.rb
+++ b/lib/puppet/file_serving/configuration.rb
@@ -94,6 +94,11 @@ class Puppet::FileServing::Configuration
private
+ def mk_default_mounts
+ @mounts["modules"] ||= Mount::Modules.new("modules")
+ @mounts["plugins"] ||= Mount::Plugins.new("plugins")
+ end
+
# Read the configuration file.
def readconfig(check = true)
config = Puppet[:fileserverconfig]
@@ -114,5 +119,9 @@ class Puppet::FileServing::Configuration
puts detail.backtrace if Puppet[:trace]
Puppet.err "Error parsing fileserver configuration: %s; using old configuration" % detail
end
+
+ ensure
+ # Make sure we've got our plugins and modules.
+ mk_default_mounts
end
end
diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb
index c86e00a62..50368fdaf 100644
--- a/lib/puppet/file_serving/configuration/parser.rb
+++ b/lib/puppet/file_serving/configuration/parser.rb
@@ -46,8 +46,6 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
}
}
- mk_default_mounts
-
validate()
return @mounts
@@ -83,12 +81,6 @@ 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)