summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-06-04 02:21:04 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-06-04 02:21:04 +0000
commita7b057de317ffc60e50405ea1ebb109ba4003b4f (patch)
tree5496c4729876e4afee002574fa4c5e326df63c82 /lib/puppet
parent0cfd28ecae07178884c7de6252db36a91ecc9062 (diff)
downloadpuppet-a7b057de317ffc60e50405ea1ebb109ba4003b4f.tar.gz
puppet-a7b057de317ffc60e50405ea1ebb109ba4003b4f.tar.xz
puppet-a7b057de317ffc60e50405ea1ebb109ba4003b4f.zip
Adding a "source" attribute to providers, so eventually types will be able to avoid duplication during listing by only listing one provider for each source (e.g., dpkg and aptitude should not both be listed).
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2550 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider.rb14
-rwxr-xr-xlib/puppet/provider/parsedfile.rb2
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index 5ab2657ba..1f18ae730 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -12,6 +12,12 @@ class Puppet::Provider
include Puppet::Util, Puppet::Util::Docs
include Puppet::Util::Logging
attr_accessor :name
+
+ # The source parameter exists so that providers using the same
+ # source can specify this, so reading doesn't attempt to read the
+ # same package multiple times.
+ attr_accessor :source
+
# LAK 2007-05-09: Keep the model stuff around for backward compatibility
attr_reader :model
attr_accessor :resource_type
@@ -182,6 +188,14 @@ class Puppet::Provider
end
end
+ # Retrieve the data source. Defaults to the provider name.
+ def self.source
+ unless defined? @source
+ @source = self.name
+ end
+ @source
+ end
+
# Check whether this implementation is suitable for our platform.
def self.suitable?(short = true)
# A single false result is sufficient to turn the whole thing down.
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb
index 3a2acf85f..09233069b 100755
--- a/lib/puppet/provider/parsedfile.rb
+++ b/lib/puppet/provider/parsedfile.rb
@@ -169,7 +169,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
end
# Retrieve all of the data from disk. There are three ways to know
- # while files to retrieve: We might have a list of file objects already
+ # which files to retrieve: We might have a list of file objects already
# set up, there might be instances of our associated resource and they
# will have a path parameter set, and we will have a default path
# set. We need to turn those three locations into a list of files,