summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface.rb
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-04-21 19:04:39 -0700
committerMax Martin <max@puppetlabs.com>2011-04-21 19:04:39 -0700
commit25593abbb044aca86c71cd60e91665eca0ce1bd1 (patch)
treed8703468b9b598c196348b748fbe47333b31a745 /lib/puppet/interface.rb
parent01f610bb223b435dc52f491260af3ea002930102 (diff)
parente4b31b411a4b3d7cce7f45197491eebc36d047aa (diff)
downloadpuppet-25593abbb044aca86c71cd60e91665eca0ce1bd1.tar.gz
puppet-25593abbb044aca86c71cd60e91665eca0ce1bd1.tar.xz
puppet-25593abbb044aca86c71cd60e91665eca0ce1bd1.zip
Merge branch 'next'
* next: (#6928) Don't blow up when the method is undefined... (#6928) backport Symbol#to_proc for Ruby < 1.8.7 (#7183) Implement "invisible glob" version matching for faces maint: better disabling of Signal#trap in our tests. maint: more robust listing of valid faces. maint: clean up testing code a fraction... maint: better error report for a missing version of a face. maint: handle face clear/reset sanely in the interface spec. maint: stop stubbing log level setting. Move tests from Puppet-acceptance repo (#7116) Handle application-level options in parse_options maint: fix gratuitous whitespace in the code. maint: remove redundant context from the test. (#7062) better argument handling in the action wrapper methods maint: move method comments outside the comment. Fixed #7166 - Replaced deprecated stomp "send" method with "publish" maint: Remove unused faces code
Diffstat (limited to 'lib/puppet/interface.rb')
-rw-r--r--lib/puppet/interface.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index 5c8ade749..ced00863d 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -26,18 +26,13 @@ class Puppet::Interface
Puppet::Interface::FaceCollection.faces
end
- def face?(name, version)
- Puppet::Interface::FaceCollection.face?(name, version)
- end
-
def register(instance)
Puppet::Interface::FaceCollection.register(instance)
end
def define(name, version, &block)
- if face?(name, version)
- face = Puppet::Interface::FaceCollection[name, version]
- else
+ face = Puppet::Interface::FaceCollection[name, version]
+ if face.nil? then
face = self.new(name, version)
Puppet::Interface::FaceCollection.register(face)
# REVISIT: Shouldn't this be delayed until *after* we evaluate the
@@ -50,10 +45,14 @@ class Puppet::Interface
return face
end
+ def face?(name, version)
+ Puppet::Interface::FaceCollection[name, version]
+ end
+
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}"
+ raise Puppet::Error, "Could not find version #{version} of #{name}"
else
raise Puppet::Error, "Could not find Puppet Face #{name.inspect}"
end