summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-14 17:49:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-14 17:49:19 +0000
commitdf4595e98f953432267756c84a37a5495e9720ef (patch)
treededa10a6947d4c6ce4777d3f9ea9922a0ddc7a70 /lib/puppet/provider.rb
parentb05ae2ae1262469df264e3a35b30f7a1d1805c18 (diff)
downloadpuppet-df4595e98f953432267756c84a37a5495e9720ef.tar.gz
puppet-df4595e98f953432267756c84a37a5495e9720ef.tar.xz
puppet-df4595e98f953432267756c84a37a5495e9720ef.zip
Significantly reworking the internals of the fileparsing code. It now
passes around an instance of a FileRecord, rather than just a hash, which I think makes it much easier to understand. Moved the sshkey parsed provider test to its own directory and made it better. This work is all being done so I can move cron jobs to using providers instead of the current unmaintainable state of affairs. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2281 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider.rb')
-rw-r--r--lib/puppet/provider.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index 3a31a89a3..23c921ac0 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -123,6 +123,22 @@ class Puppet::Provider
end
end
+ # Create getter/setter methods for each property our model supports.
+ # They all get stored in @property_hash. This method is useful
+ # for those providers that use prefetch and flush.
+ def self.mkmodelmethods
+ [model.validproperties, model.parameters].flatten.each do |attr|
+ attr = symbolize(attr)
+ define_method(attr) do
+ @property_hash[attr] || :absent
+ end
+
+ define_method(attr.to_s + "=") do |val|
+ @property_hash[attr] = val
+ end
+ end
+ end
+
self.initvars
# Check whether this implementation is suitable for our platform.
@@ -208,6 +224,7 @@ class Puppet::Provider
def initialize(model)
@model = model
+ @property_hash = {}
end
def name