summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-24 17:10:00 -0500
committerLuke Kanies <luke@madstop.com>2008-03-24 17:10:00 -0500
commit6a535195a908ce80ce41a403d642b3afa871534f (patch)
treee99f2844f76b38ca74808340bb53b3d169ebbaea /lib
parent528bbf1caefdd6963353df9242b81409f4dacbe5 (diff)
downloadpuppet-6a535195a908ce80ce41a403d642b3afa871534f.tar.gz
puppet-6a535195a908ce80ce41a403d642b3afa871534f.tar.xz
puppet-6a535195a908ce80ce41a403d642b3afa871534f.zip
Fixing #571 -- provider suitability is now checked at resource
evaluation time, rather than resource instantiation time. This means that you don't catch your "errors" as early, but it also means you should be able to realistically configure a whole host in one run.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/metatype/evaluation.rb5
-rw-r--r--lib/puppet/metatype/providers.rb11
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/puppet/metatype/evaluation.rb b/lib/puppet/metatype/evaluation.rb
index 8d435333f..ff1eddb55 100644
--- a/lib/puppet/metatype/evaluation.rb
+++ b/lib/puppet/metatype/evaluation.rb
@@ -4,6 +4,11 @@ class Puppet::Type
# This returns any changes resulting from testing, thus 'collect' rather
# than 'each'.
def evaluate
+ if self.provider.is_a?(Puppet::Provider)
+ unless provider.class.suitable?
+ raise Puppet::Error, "Provider %s is not functional on this platform" % provider.class.name
+ end
+ end
#Puppet.err "Evaluating %s" % self.path.join(":")
unless defined? @evalcount
self.err "No evalcount defined on '%s' of type '%s'" %
diff --git a/lib/puppet/metatype/providers.rb b/lib/puppet/metatype/providers.rb
index c302d9928..6308f7e54 100644
--- a/lib/puppet/metatype/providers.rb
+++ b/lib/puppet/metatype/providers.rb
@@ -188,15 +188,8 @@ class Puppet::Type
provider_class = provider_class.class.name
end
- if provider = @resource.class.provider(provider_class)
- unless provider.suitable?
- raise ArgumentError,
- "Provider '%s' is not functional on this platform" %
- [provider_class]
- end
- else
- raise ArgumentError, "Invalid %s provider '%s'" %
- [@resource.class.name, provider_class]
+ unless provider = @resource.class.provider(provider_class)
+ raise ArgumentError, "Invalid %s provider '%s'" % [@resource.class.name, provider_class]
end
end