Method: Puppet::Interface::FaceCollection.get_action_for_face

Defined in:
lib/puppet/interface/face_collection.rb

.get_action_for_face(name, action_name, version) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/puppet/interface/face_collection.rb', line 24

def self.get_action_for_face(name, action_name, version)
  name = underscorize(name)

  # If the version they request specifically doesn't exist, don't search
  # elsewhere.  Usually this will start from :current and all...
  face = self[name, version]
  return nil unless face

  action = face.get_action(action_name)
  unless action
    # ...we need to search for it bound to an o{lder,ther} version.  Since
    # we load all actions when the face is first references, this will be in
    # memory in the known set of versions of the face.
    (@faces[name].keys - [:current]).sort.reverse_each do |vers|
      action = @faces[name][vers].get_action(action_name)
      break if action
    end
  end

  action
end