class Puppet::Indirector::Face
Attributes
from[RW]
Public Class Methods
indirections()
click to toggle source
# File lib/puppet/indirector/face.rb 33 def self.indirections 34 Puppet::Indirector::Indirection.instances.collect { |t| t.to_s }.sort 35 end
terminus_classes(indirection)
click to toggle source
# File lib/puppet/indirector/face.rb 37 def self.terminus_classes(indirection) 38 Puppet::Indirector::Terminus.terminus_classes(indirection.to_sym).collect { |t| t.to_s }.sort 39 end
Public Instance Methods
call_indirection_method(method, key, options)
click to toggle source
# File lib/puppet/indirector/face.rb 41 def call_indirection_method(method, key, options) 42 begin 43 if method == :save 44 # key is really the instance to save 45 result = indirection.__send__(method, key, nil, options) 46 else 47 result = indirection.__send__(method, key, options) 48 end 49 rescue => detail 50 message = _("Could not call '%{method}' on '%{indirection}': %{detail}") % { method: method, indirection: indirection_name, detail: detail } 51 Puppet.log_exception(detail, message) 52 raise RuntimeError, message, detail.backtrace 53 end 54 55 return result 56 end
indirection()
click to toggle source
Return an indirection associated with a face, if one exists; One usually does.
# File lib/puppet/indirector/face.rb 127 def indirection 128 unless @indirection 129 @indirection = Puppet::Indirector::Indirection.instance(indirection_name) 130 @indirection or raise _("Could not find terminus for %{indirection}") % { indirection: indirection_name } 131 end 132 @indirection 133 end
indirection_name()
click to toggle source
# File lib/puppet/indirector/face.rb 115 def indirection_name 116 @indirection_name || name.to_sym 117 end
set_indirection_name(name)
click to toggle source
Here's your opportunity to override the indirection name. By default it will be the same name as the face.
# File lib/puppet/indirector/face.rb 121 def set_indirection_name(name) 122 @indirection_name = name 123 end
set_terminus(from)
click to toggle source
# File lib/puppet/indirector/face.rb 135 def set_terminus(from) 136 begin 137 indirection.terminus_class = from 138 rescue => detail 139 msg = _("Could not set '%{indirection}' terminus to '%{from}' (%{detail}); valid terminus types are %{types}") % { indirection: indirection.name, from: from, detail: detail, types: self.class.terminus_classes(indirection.name).join(", ") } 140 raise detail, msg, detail.backtrace 141 end 142 end