summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/interface.rb')
-rw-r--r--lib/puppet/interface.rb67
1 files changed, 1 insertions, 66 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index 08a26db90..999c38bad 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -38,21 +38,6 @@ class Puppet::Interface
end).sort { |a,b| a.to_s <=> b.to_s }
end
- # Here's your opportunity to override the indirection name. By default
- # it will be the same name as the interface.
- def self.indirection_name
- name.to_sym
- end
-
- # Return an indirection associated with an interface, if one exists
- # One usually does.
- def self.indirection
- unless @indirection
- raise "Could not find data type '#{indirection_name}' for interface '#{name}'" unless @indirection = Puppet::Indirector::Indirection.instance(indirection_name)
- end
- @indirection
- end
-
# Return an interface by name, loading from disk if necessary.
def self.interface(name)
require "puppet/interface/#{name.to_s.downcase}"
@@ -83,7 +68,7 @@ class Puppet::Interface
@name || self.to_s.sub(/.+::/, '').downcase
end
- attr_accessor :from, :type, :verb, :name, :arguments, :indirection
+ attr_accessor :type, :verb, :name, :arguments
def action?(name)
self.class.actions.include?(name.to_sym)
@@ -98,26 +83,6 @@ class Puppet::Interface
end
end
- action :destroy do |name, *args|
- call_indirection_method(:destroy, name, *args)
- end
-
- action :find do |name, *args|
- call_indirection_method(:find, name, *args)
- end
-
- action :save do |name, *args|
- call_indirection_method(:save, name, *args)
- end
-
- action :search do |name, *args|
- call_indirection_method(:search, name, *args)
- end
-
- def indirection
- self.class.indirection
- end
-
def initialize(options = {})
options.each { |opt, val| send(opt.to_s + "=", val) }
@@ -126,34 +91,4 @@ class Puppet::Interface
self.class.load_actions
end
- def set_terminus(from)
- begin
- indirection.terminus_class = from
- rescue => detail
- raise "Could not set '#{indirection.name}' terminus to '#{from}' (#{detail}); valid terminus types are #{terminus_classes(indirection.name).join(", ") }"
- end
- end
-
- def call_indirection_method(method, name, *args)
- begin
- result = indirection.send(method, name, *args)
- rescue => detail
- puts detail.backtrace if Puppet[:trace]
- raise "Could not call #{method} on #{type}: #{detail}"
- end
-
- unless result
- raise "Could not #{method} #{indirection.name} for #{name}"
- end
-
- result
- end
-
- def indirections
- Puppet::Indirector::Indirection.instances.collect { |t| t.to_s }.sort
- end
-
- def terminus_classes(indirection)
- Puppet::Indirector::Terminus.terminus_classes(indirection).collect { |t| t.to_s }.sort
- end
end