class PuppetDebugger::InputResponders::Types

Constants

COMMAND_GROUP
COMMAND_WORDS
SUMMARY

Public Instance Methods

run(_args = []) click to toggle source

@return - returns a list of types available to the environment if a error occurs we we run the types function again

# File lib/plugins/puppet-debugger/input_responders/types.rb, line 13
def run(_args = [])
  types
end
types() click to toggle source
# File lib/plugins/puppet-debugger/input_responders/types.rb, line 17
def types
  loaded_types = []
  begin
    # this loads all the types, if already loaded the file is skipped
    Puppet::Type.loadall
    Puppet::Type.eachtype do |t|
      next if t.name == :component

      loaded_types << t.name.to_s
    end
    loaded_types.ai
  rescue Puppet::Error => e
    puts e.message.red
    Puppet.info(e.message)
    # prevent more than two calls and recursive loop
    return if caller_locations(1, 10).find_all { |f| f.label == 'types' }.count > 2

    types
  end
end