summaryrefslogtreecommitdiffstats
path: root/lib/puppet/file_serving/mount.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-11 12:45:50 -0800
committerLuke Kanies <luke@madstop.com>2008-11-11 12:53:38 -0800
commitcd09d6b90d3365d06e8e706aab3edbd8f568f1c9 (patch)
tree1ebc569b688e17d70882415e897387c9d75b9213 /lib/puppet/file_serving/mount.rb
parent14af971bc618d665f481142934b2f612d503823c (diff)
downloadpuppet-cd09d6b90d3365d06e8e706aab3edbd8f568f1c9.tar.gz
puppet-cd09d6b90d3365d06e8e706aab3edbd8f568f1c9.tar.xz
puppet-cd09d6b90d3365d06e8e706aab3edbd8f568f1c9.zip
Refactoring the Cacher interface to always require attribute declaration.
Previously you could dynamically use cached values, but the new interface requires a single static declaration of the attribute: cached_attr(:myattr) { my_init_code() } This is cleaner, because it makes it easy to turn the code into an init method and generally makes the whole thing easier to think about. Most of this commit is going through the different classes that already using the Caching engine. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/file_serving/mount.rb')
-rw-r--r--lib/puppet/file_serving/mount.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/puppet/file_serving/mount.rb b/lib/puppet/file_serving/mount.rb
index c52cedbfb..552cf33f2 100644
--- a/lib/puppet/file_serving/mount.rb
+++ b/lib/puppet/file_serving/mount.rb
@@ -13,16 +13,17 @@ require 'puppet/file_serving/content'
# or content objects.
class Puppet::FileServing::Mount < Puppet::Network::AuthStore
include Puppet::Util::Logging
- extend Puppet::Util::Cacher
- def self.localmap
- attr_cache(:localmap) {
+ class << self
+ include Puppet::Util::Cacher
+
+ cached_attr(:localmap) do
{ "h" => Facter.value("hostname"),
"H" => [Facter.value("hostname"),
Facter.value("domain")].join("."),
"d" => Facter.value("domain")
}
- }
+ end
end
attr_reader :name