Class: Puppet::Pops::Loader::StaticLoader

Inherits:
Loader show all
Defined in:
lib/puppet/pops/loader/static_loader.rb

Constant Summary collapse

BUILTIN_TYPE_NAMES =
%w{
  Auegas
  Component
  Computer
  Cron
  Exec
  File
  Filebucket
  Group
  Host
  Interface
  K5login
  Macauthorization
  Mailalias
  Maillist
  Mcx
  Mount
  Nagios_command
  Nagios_contact
  Nagios_contactgroup
  Nagios_host
  Nagios_hostdependency
  Nagios_hostescalation
  Nagios_hostgroup
  Nagios_hostextinfo
  Nagios_service
  Nagios_servicedependency
  Nagios_serviceescalation
  Nagios_serviceextinfo
  Nagios_servicegroup
  Nagios_timeperiod
  Node
  Notify
  Package
  Resources
  Router
  Schedule
  Scheduled_task
  Selboolean
  Selmodule
  Service
  Ssh_authorized_key
  Sshkey
  Stage
  Tidy
  User
  Vlan
  Whit
  Yumrepo
  Zfs
  Zone
  Zpool
}.freeze
BUILTIN_TYPE_NAMES_LC =
Set.new(BUILTIN_TYPE_NAMES.map { |n| n.downcase }).freeze
BUILTIN_ALIASES =
{
  'Data' => 'Variant[ScalarData,Undef,Hash[String,Data],Array[Data]]',
  'RichDataKey' => 'Variant[String,Numeric]',
  'RichData' => 'Variant[Scalar,SemVerRange,Binary,Sensitive,Type,TypeSet,Undef,Default,Hash[RichDataKey,RichData],Array[RichData]]',

  # Backward compatible aliases.
  'Puppet::LookupKey' => 'RichDataKey',
  'Puppet::LookupValue' => 'RichData'
}.freeze

Constants inherited from Loader

Loader::LOADABLE_KINDS

Instance Attribute Summary collapse

Attributes inherited from Loader

#loader_name

Instance Method Summary collapse

Methods inherited from Loader

#[], #inspect, #load, #loadables, #private_loader

Constructor Details

#initializeStaticLoader

Returns a new instance of StaticLoader.



75
76
77
78
79
80
# File 'lib/puppet/pops/loader/static_loader.rb', line 75

def initialize
  @loaded = {}
  create_built_in_types
  create_resource_type_references
  register_aliases
end

Instance Attribute Details

#loadedObject (readonly)



74
75
76
# File 'lib/puppet/pops/loader/static_loader.rb', line 74

def loaded
  @loaded
end

Instance Method Details

#find(name) ⇒ Object



94
95
96
97
# File 'lib/puppet/pops/loader/static_loader.rb', line 94

def find(name)
  # There is nothing to search for, everything this loader knows about is already available
  nil
end

#get_entry(typed_name) ⇒ Object



86
87
88
# File 'lib/puppet/pops/loader/static_loader.rb', line 86

def get_entry(typed_name)
  load_constant(typed_name)
end

#load_typed(typed_name) ⇒ Object



82
83
84
# File 'lib/puppet/pops/loader/static_loader.rb', line 82

def load_typed(typed_name)
  load_constant(typed_name)
end

#loaded_entry(typed_name, check_dependencies = false) ⇒ Object



107
108
109
# File 'lib/puppet/pops/loader/static_loader.rb', line 107

def loaded_entry(typed_name, check_dependencies = false)
  @loaded[typed_name]
end

#parentObject



99
100
101
# File 'lib/puppet/pops/loader/static_loader.rb', line 99

def parent
  nil # at top of the hierarchy
end

#set_entry(typed_name, value, origin = nil) ⇒ Object



90
91
92
# File 'lib/puppet/pops/loader/static_loader.rb', line 90

def set_entry(typed_name, value, origin = nil)
  @loaded[typed_name] = Loader::NamedEntry.new(typed_name, value, origin)
end

#to_sObject



103
104
105
# File 'lib/puppet/pops/loader/static_loader.rb', line 103

def to_s()
  "(StaticLoader)"
end