summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface.rb
diff options
context:
space:
mode:
authorDan Bode <dan@puppetlabs.com>2011-04-07 16:18:27 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-07 16:18:54 -0700
commitd9f23c0801d7d40809326face37463aeb67a3cdd (patch)
tree65a5fbe4f617926b3b17be0397db97293199b566 /lib/puppet/interface.rb
parent292a8b92c74c8d9392348ef6e9718934471a0ac1 (diff)
downloadpuppet-d9f23c0801d7d40809326face37463aeb67a3cdd.tar.gz
puppet-d9f23c0801d7d40809326face37463aeb67a3cdd.tar.xz
puppet-d9f23c0801d7d40809326face37463aeb67a3cdd.zip
(#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 <daniel@puppetlabs.com>
Diffstat (limited to 'lib/puppet/interface.rb')
-rw-r--r--lib/puppet/interface.rb11
1 files changed, 10 insertions, 1 deletions
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