From d9f23c0801d7d40809326face37463aeb67a3cdd Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Thu, 7 Apr 2011 16:18:27 -0700 Subject: (#6969) String failures differentiate between invalid string/version This patch does two things: 1. splits out the string lookup functionality from define into a seperate method [] 2. Tries to both load the specific version of a string as well as the current version so that specific error messages can be returned differentiating between an invalid version/string. Reviewed-By: Daniel Pittman --- lib/puppet/interface.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 70484adfc..07e27efa8 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -50,7 +50,16 @@ class Puppet::Interface return face end - alias :[] :define + def [](name, version) + unless face = Puppet::Interface::FaceCollection[name, version] + if current = Puppet::Interface::FaceCollection[name, :current] + raise Puppet::Error, "Could not find version #{version} of #{current}" + else + raise Puppet::Error, "Could not find Puppet Face #{name.inspect}" + end + end + face + end end attr_accessor :default_format -- cgit