puppet 5.0.1-x86-mingw32 → 5.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puppet/agent.rb +1 -0
  3. data/lib/puppet/defaults.rb +1 -1
  4. data/lib/puppet/functions.rb +6 -7
  5. data/lib/puppet/functions/all.rb +100 -0
  6. data/lib/puppet/functions/any.rb +105 -0
  7. data/lib/puppet/functions/defined.rb +3 -3
  8. data/lib/puppet/functions/new.rb +2 -1
  9. data/lib/puppet/functions/reduce.rb +31 -0
  10. data/lib/puppet/functions/tree_each.rb +200 -0
  11. data/lib/puppet/module.rb +30 -0
  12. data/lib/puppet/parser/functions/new.rb +67 -0
  13. data/lib/puppet/parser/functions/reduce.rb +31 -0
  14. data/lib/puppet/parser/relationship.rb +2 -2
  15. data/lib/puppet/parser/resource.rb +39 -10
  16. data/lib/puppet/parser/scope.rb +1 -1
  17. data/lib/puppet/pops/evaluator/access_operator.rb +11 -4
  18. data/lib/puppet/pops/evaluator/collector_transformer.rb +1 -1
  19. data/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -4
  20. data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
  21. data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -3
  22. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
  23. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  24. data/lib/puppet/pops/loader/static_loader.rb +1 -2
  25. data/lib/puppet/pops/loaders.rb +1 -2
  26. data/lib/puppet/pops/lookup/context.rb +1 -1
  27. data/lib/puppet/pops/lookup/lookup_adapter.rb +2 -1
  28. data/lib/puppet/pops/model/ast.rb +440 -436
  29. data/lib/puppet/pops/model/factory.rb +140 -140
  30. data/lib/puppet/pops/pcore.rb +1 -2
  31. data/lib/puppet/pops/resource/param.rb +1 -1
  32. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  33. data/lib/puppet/pops/serialization/from_data_converter.rb +0 -12
  34. data/lib/puppet/pops/time/timestamp.rb +29 -17
  35. data/lib/puppet/pops/types/annotatable.rb +2 -2
  36. data/lib/puppet/pops/types/annotation.rb +8 -8
  37. data/lib/puppet/pops/types/class_loader.rb +3 -3
  38. data/lib/puppet/pops/types/implementation_registry.rb +1 -1
  39. data/lib/puppet/pops/types/iterable.rb +2 -2
  40. data/lib/puppet/pops/types/p_binary_type.rb +2 -2
  41. data/lib/puppet/pops/types/p_init_type.rb +238 -0
  42. data/lib/puppet/pops/types/p_meta_type.rb +14 -11
  43. data/lib/puppet/pops/types/p_object_type.rb +15 -15
  44. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +2 -2
  45. data/lib/puppet/pops/types/p_sem_ver_type.rb +2 -2
  46. data/lib/puppet/pops/types/p_sensitive_type.rb +2 -2
  47. data/lib/puppet/pops/types/p_timespan_type.rb +6 -6
  48. data/lib/puppet/pops/types/p_timestamp_type.rb +6 -2
  49. data/lib/puppet/pops/types/p_type_set_type.rb +10 -9
  50. data/lib/puppet/pops/types/ruby_generator.rb +6 -5
  51. data/lib/puppet/pops/types/ruby_method.rb +2 -2
  52. data/lib/puppet/pops/types/string_converter.rb +1 -1
  53. data/lib/puppet/pops/types/tree_iterators.rb +250 -0
  54. data/lib/puppet/pops/types/type_calculator.rb +13 -13
  55. data/lib/puppet/pops/types/type_factory.rb +26 -7
  56. data/lib/puppet/pops/types/type_formatter.rb +9 -4
  57. data/lib/puppet/pops/types/type_parser.rb +8 -3
  58. data/lib/puppet/pops/types/type_set_reference.rb +2 -2
  59. data/lib/puppet/pops/types/types.rb +168 -109
  60. data/lib/puppet/provider/package/gem.rb +10 -9
  61. data/lib/puppet/provider/package/pip.rb +12 -3
  62. data/lib/puppet/provider/package/yum.rb +9 -1
  63. data/lib/puppet/resource/capability_finder.rb +30 -11
  64. data/lib/puppet/type/file.rb +21 -13
  65. data/lib/puppet/util/execution.rb +67 -14
  66. data/lib/puppet/util/suidmanager.rb +1 -0
  67. data/lib/puppet/version.rb +1 -1
  68. data/locales/puppet.pot +130 -66
  69. data/man/man5/puppet.conf.5 +1 -1
  70. data/spec/fixtures/unit/provider/package/yum/yum-check-update-simple.txt +1 -0
  71. data/spec/integration/parser/collection_spec.rb +40 -1
  72. data/spec/shared_contexts/types_setup.rb +41 -2
  73. data/spec/unit/agent_spec.rb +11 -0
  74. data/spec/unit/file_bucket/dipper_spec.rb +13 -4
  75. data/spec/unit/functions/all_spec.rb +97 -0
  76. data/spec/unit/functions/any_spec.rb +109 -0
  77. data/spec/unit/functions/hiera_spec.rb +5 -0
  78. data/spec/unit/functions/new_spec.rb +66 -0
  79. data/spec/unit/functions/tree_each_spec.rb +444 -0
  80. data/spec/unit/module_spec.rb +29 -0
  81. data/spec/unit/pops/serialization/serialization_spec.rb +2 -2
  82. data/spec/unit/pops/serialization/to_from_hr_spec.rb +2 -2
  83. data/spec/unit/pops/types/iterable_spec.rb +9 -9
  84. data/spec/unit/pops/types/p_init_type_spec.rb +285 -0
  85. data/spec/unit/pops/types/p_object_type_spec.rb +8 -8
  86. data/spec/unit/pops/types/p_sensitive_type_spec.rb +4 -0
  87. data/spec/unit/pops/types/p_timespan_type_spec.rb +14 -0
  88. data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -1
  89. data/spec/unit/pops/types/p_type_set_type_spec.rb +2 -2
  90. data/spec/unit/pops/types/ruby_generator_spec.rb +9 -22
  91. data/spec/unit/pops/types/string_converter_spec.rb +2 -2
  92. data/spec/unit/pops/types/type_acceptor_spec.rb +2 -2
  93. data/spec/unit/pops/types/type_calculator_spec.rb +43 -38
  94. data/spec/unit/pops/types/type_factory_spec.rb +6 -6
  95. data/spec/unit/pops/types/type_formatter_spec.rb +6 -6
  96. data/spec/unit/pops/types/types_spec.rb +16 -4
  97. data/spec/unit/provider/package/gem_spec.rb +6 -6
  98. data/spec/unit/provider/package/pip_spec.rb +44 -23
  99. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  100. data/spec/unit/provider/package/yum_spec.rb +8 -0
  101. data/spec/unit/resource/capability_finder_spec.rb +4 -5
  102. data/spec/unit/type/file_spec.rb +19 -14
  103. data/spec/unit/util/execution_spec.rb +216 -82
  104. data/tasks/generate_ast_model.rake +10 -2
  105. metadata +15 -2
@@ -95,6 +95,17 @@ class Puppet::Module
95
95
  load_metadata
96
96
 
97
97
  @absolute_path_to_manifests = Puppet::FileSystem::PathPattern.absolute(manifests)
98
+
99
+ # i18n initialization for modules
100
+ if Puppet::GETTEXT_AVAILABLE
101
+ begin
102
+ initialize_i18n
103
+ rescue Exception => e
104
+ Puppet.warning _("GettextSetup initialization for %{module_name} failed with: %{error_message}") % { module_name: name, error_message: e.message }
105
+ end
106
+ else
107
+ Puppet.warning _("GettextSetup is not available, skipping GettextSetup initialization for %{module_name}.") % { module_name: name }
108
+ end
98
109
  end
99
110
 
100
111
  # @deprecated The puppetversion module metadata field is no longer used.
@@ -385,8 +396,27 @@ class Puppet::Module
385
396
  @strict_semver
386
397
  end
387
398
 
399
+ def initialize_i18n
400
+ module_name = @forge_name.gsub("/","-") if @forge_name
401
+ return if module_name.nil? || i18n_initialized?(module_name)
402
+
403
+ locales_path = File.absolute_path('locales', path)
404
+
405
+ begin
406
+ GettextSetup.initialize(locales_path)
407
+ Puppet.debug "#{module_name} initialized for i18n: #{GettextSetup.translation_repositories[module_name]}"
408
+ rescue
409
+ config_path = File.absolute_path('config.yaml', locales_path)
410
+ Puppet.debug "Could not find locales configuration file for #{module_name} at #{config_path}. Skipping i18n initialization."
411
+ end
412
+ end
413
+
388
414
  private
389
415
 
416
+ def i18n_initialized?(module_name)
417
+ GettextSetup.translation_repositories.has_key? module_name
418
+ end
419
+
390
420
  def wanted_manifests_from(pattern)
391
421
  begin
392
422
  extended = File.extname(pattern).empty? ? "#{pattern}.pp" : pattern
@@ -475,6 +475,16 @@ $ts = Timestamp('2016-08-24T12:13:14', default, 'PST') # 2016-08-24 20:13:14.0
475
475
 
476
476
  ```
477
477
 
478
+ Conversion to Type
479
+ ------------------
480
+ A new `Type` can be create from its `String` representation.
481
+
482
+ **Example:** Creating a type from a string
483
+
484
+ ```puppet
485
+ $t = Type.new('Integer[10]')
486
+ ```
487
+
478
488
  Conversion to String
479
489
  --------------------
480
490
 
@@ -772,6 +782,32 @@ Accepts a single value as argument:
772
782
  * An `Iterable` is turned into an `Array` and then converted to hash as per the array rules
773
783
  * A `Hash` is simply returned
774
784
 
785
+ Alternatively, a tree can be constructed by giving two values; an array of tuples on the form `[path, value]`
786
+ (where the `path` is the path from the root of a tree, and `value` the value at that position in the tree), and
787
+ either the option `'tree'` (do not convert arrays to hashes except the top level), or
788
+ `'hash_tree'` (convert all arrays to hashes).
789
+
790
+ The tree/hash_tree forms of Hash creation are suited for transforming the result of an iteration
791
+ using `tree_each` and subsequent filtering or mapping.
792
+
793
+ **Example:** Mapping a hash tree
794
+
795
+ Mapping an arbitrary structure in a way that keeps the structure, but where some values are replaced
796
+ can be done by using the `tree_each` function, mapping, and then constructing a new Hash from the result:
797
+
798
+ ```puppet
799
+ # A hash tree with 'water' at different locations
800
+ $h = { a => { b => { x => 'water'}}, b => { y => 'water'} }
801
+ # a helper function that turns water into wine
802
+ function make_wine($x) { if $x == 'water' { 'wine' } else { $x } }
803
+ # create a flattened tree with water turned into wine
804
+ $flat_tree = $h.tree_each.map |$entry| { [$entry[0], make_wine($entry[1])] }
805
+ # create a new Hash and log it
806
+ notice Hash($flat_tree, 'hash_tree')
807
+ ```
808
+
809
+ Would notice the hash `{a => {b => {x => wine}}, b => {y => wine}}`
810
+
775
811
  Conversion to a `Struct` works exactly as conversion to a `Hash`, only that the constructed hash is
776
812
  asserted against the given struct type.
777
813
 
@@ -932,6 +968,37 @@ $b = binary_file('mymodule/mypicture.jpg')
932
968
  * Since 4.5.0
933
969
  * Binary type since 4.8.0
934
970
 
971
+ Creating an instance of a `Type` using the `Init` type.
972
+ -------
973
+
974
+ The type `Init[T]` describes a value that can be used when instantiating a type. When used as the first argument in a call to `new`, it
975
+ will dispatch the call to its contained type and optionally augment the parameter list with additional arguments.
976
+
977
+ **Example:** Creating an instance of Integer using Init[Integer]
978
+
979
+ ```puppet
980
+ # The following declaration
981
+ $x = Init[Integer].new('128')
982
+ # is exactly the same as
983
+ $x = Integer.new('128')
984
+ ```
985
+
986
+ or, with base 16 and using implicit new
987
+
988
+ ```puppet
989
+ # The following declaration
990
+ $x = Init[Integer,16]('80')
991
+ # is exactly the same as
992
+ $x = Integer('80', 16)
993
+ ```
994
+
995
+ **Example:** Creating an instance of String using a predefined format
996
+
997
+ ```puppet
998
+ $fmt = Init[String,'%#x']
999
+ notice($fmt(256)) # will notice '0x100'
1000
+ ```
1001
+
935
1002
  DOC
936
1003
  ) do |args|
937
1004
  Puppet::Parser::Functions::Error.is4x('new')
@@ -99,6 +99,37 @@ $combine = $data.reduce( [d, 4] ) |$memo, $value| {
99
99
  # $combine contains [dabc, 10]
100
100
  ~~~
101
101
 
102
+ **Example**: Using the `reduce` function to reduce a hash of hashes
103
+
104
+ ~~~ puppet
105
+ # Reduce a hash of hashes $data, merging defaults into the inner hashes.
106
+ $data = {
107
+ 'connection1' => {
108
+ 'username' => 'user1',
109
+ 'password' => 'pass1',
110
+ },
111
+ 'connection_name2' => {
112
+ 'username' => 'user2',
113
+ 'password' => 'pass2',
114
+ },
115
+ }
116
+
117
+ $defaults = {
118
+ 'maxActive' => '20',
119
+ 'maxWait' => '10000',
120
+ 'username' => 'defaultuser',
121
+ 'password' => 'defaultpass',
122
+ }
123
+
124
+ $merged = $data.reduce( {} ) |$memo, $x| {
125
+ $memo + { $x[0] => $defaults + $data[$x[0]] }
126
+ }
127
+ # At the start of the lambda's first iteration, $memo is set to {}, and $x is set to
128
+ # the first [key, value] tuple. The key in $data is, therefore, given by $x[0]. In
129
+ # subsequent rounds, $memo retains the value returned by the expression, i.e.
130
+ # $memo + { $x[0] => $defaults + $data[$x[0]] }.
131
+ ~~~
132
+
102
133
  - Since 4.0.0
103
134
  DOC
104
135
  ) do |args|
@@ -67,14 +67,14 @@ class Puppet::Parser::Relationship
67
67
  end
68
68
  end
69
69
 
70
- # Turns a PResourceType or PHostClassType into an array [type, title] and all other references to [ref, nil]
70
+ # Turns a PResourceType or PClassType into an array [type, title] and all other references to [ref, nil]
71
71
  # This is needed since it is not possible to find resources in the catalog based on the type system types :-(
72
72
  # (note, the catalog is also used on the agent side)
73
73
  def canonical_ref(ref)
74
74
  case ref
75
75
  when Puppet::Pops::Types::PResourceType
76
76
  [ref.type_name, ref.title]
77
- when Puppet::Pops::Types::PHostClassType
77
+ when Puppet::Pops::Types::PClassType
78
78
  ['class', ref.class_name]
79
79
  else
80
80
  [ref.to_s, nil]
@@ -167,6 +167,18 @@ class Puppet::Parser::Resource < Puppet::Resource
167
167
  unless self.source.object_id == resource.source.object_id || resource.source.child_of?(self.source)
168
168
  raise Puppet::ParseError.new(_("Only subclasses can override parameters"), resource.file, resource.line)
169
169
  end
170
+
171
+ if evaluated?
172
+ strict = Puppet[:strict]
173
+ unless strict == :off
174
+ msg = _('Attempt to override an already evaluated resource%{location} with new values') %
175
+ { resource: ref, location: append_location(file, line, _(', defined'), ',') }
176
+ raise Puppet::ParseError.new(msg, resource.file, resource.line) if strict == :error
177
+ msg << append_location(resource.file, resource.line)
178
+ Puppet.warning(msg)
179
+ end
180
+ end
181
+
170
182
  # Some of these might fail, but they'll fail in the way we want.
171
183
  resource.parameters.each do |name, param|
172
184
  override_parameter(param)
@@ -258,7 +270,7 @@ class Puppet::Parser::Resource < Puppet::Resource
258
270
  t = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type(scope, t) unless t == 'class' || t == 'node'
259
271
  cap = catalog.resource(t, ref.title)
260
272
  if cap.nil?
261
- raise _("Resource %{ref} could not be found; it might not have been produced yet") % { ref: ref }
273
+ raise Puppet::Error, _("Resource %{ref} could not be found; it might not have been produced yet") % { ref: ref }
262
274
  end
263
275
 
264
276
  # Ensure that the found resource is a capability resource
@@ -310,6 +322,28 @@ class Puppet::Parser::Resource < Puppet::Resource
310
322
 
311
323
  private
312
324
 
325
+ # Append location to the message if location is present. If it is not, an empty string
326
+ # is returned instead.
327
+ #
328
+ # @param file [String] path to the file
329
+ # @param line [Integer] the line in the file
330
+ # @param prefix [String] string prefix
331
+ # @param suffix [String] string suffix
332
+ # @return [String] the formatted location or an empty string
333
+ def append_location(file, line, prefix = '', suffix = '')
334
+ if file && file != ''
335
+ if line
336
+ _('%{prefix} at %{file}:%{line}%{suffix}') % { prefix: prefix, suffix: suffix, file: file, line: line }
337
+ else
338
+ _('%{prefix} in %{file}%{suffix}') % { prefix: prefix, suffix: suffix, file: file }
339
+ end
340
+ elsif line
341
+ _('%{prefix} at line %{line}%{suffix}') % { prefix: prefix, suffix: suffix, line: line }
342
+ else
343
+ ''
344
+ end
345
+ end
346
+
313
347
  def add_scope_tags
314
348
  scope_resource = scope.resource
315
349
  unless scope_resource.nil? || scope_resource.equal?(self)
@@ -337,15 +371,10 @@ class Puppet::Parser::Resource < Puppet::Resource
337
371
 
338
372
  # The parameter is already set. Fail if they're not allowed to override it.
339
373
  unless param.source.child_of?(current.source) || param.source.equal?(current.source) && scope.is_default?(type, param.name, current.value)
340
- msg = "Parameter '#{param.name}' is already set on #{self}"
341
- msg += " by #{current.source}" if current.source.to_s != ""
342
- if current.file or current.line
343
- fields = []
344
- fields << current.file if current.file
345
- fields << current.line.to_s if current.line
346
- msg += " at #{fields.join(":")}"
347
- end
348
- msg += "; cannot redefine"
374
+ msg = _("Parameter '%{name}' is already set on %{resource}") % { name: param.name, resource: ref }
375
+ msg << _(' by %{source}') % { source: current.source.to_s } unless current.source.to_s == ''
376
+ msg << append_location(current.file, current.line)
377
+ msg << _('; cannot redefine')
349
378
  raise Puppet::ParseError.new(msg, param.file, param.line)
350
379
  end
351
380
 
@@ -1043,7 +1043,7 @@ class Puppet::Parser::Scope
1043
1043
  assert_class_and_title(name.type, name.title)
1044
1044
  name.title.sub(/^([^:]{1,2})/, '::\1')
1045
1045
 
1046
- when Puppet::Pops::Types::PHostClassType
1046
+ when Puppet::Pops::Types::PClassType
1047
1047
  #TRANSLATORS "Class" and "Type" are Puppet keywords and should not be translated
1048
1048
  raise ArgumentError, _("Cannot use an unspecific Class[] Type") unless name.class_name
1049
1049
  name.class_name.sub(/^([^:]{1,2})/, '::\1')
@@ -347,18 +347,25 @@ class AccessOperator
347
347
  end
348
348
  end
349
349
 
350
- def access_PType(o, scope, keys)
350
+ def access_PTypeType(o, scope, keys)
351
351
  keys.flatten!
352
352
  if keys.size == 1
353
353
  unless keys[0].is_a?(Types::PAnyType)
354
354
  fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Type-Type', :actual => keys[0].class})
355
355
  end
356
- Types::PType.new(keys[0])
356
+ Types::PTypeType.new(keys[0])
357
357
  else
358
358
  fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic, {:base_type => 'Type-Type', :min => 1, :actual => keys.size})
359
359
  end
360
360
  end
361
361
 
362
+ def access_PInitType(o, scope, keys)
363
+ unless keys[0].is_a?(Types::PAnyType)
364
+ fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Init-Type', :actual => keys[0].class})
365
+ end
366
+ Types::TypeFactory.init(*keys)
367
+ end
368
+
362
369
  def access_PIterableType(o, scope, keys)
363
370
  keys.flatten!
364
371
  if keys.size == 1
@@ -618,7 +625,7 @@ class AccessOperator
618
625
 
619
626
  NS = '::'.freeze
620
627
 
621
- def access_PHostClassType(o, scope, keys)
628
+ def access_PClassType(o, scope, keys)
622
629
  blamed = keys.size == 0 ? @semantic : @semantic.keys[0]
623
630
  keys_orig_size = keys.size
624
631
 
@@ -651,7 +658,7 @@ class AccessOperator
651
658
  name = name[2..-1] if name[0,2] == NS
652
659
 
653
660
  fail(Issues::ILLEGAL_NAME, @semantic.keys[i], {:name=>c}) unless name =~ Patterns::NAME
654
- Types::PHostClassType.new(name)
661
+ Types::PClassType.new(name)
655
662
  end
656
663
  else
657
664
  # lookup class resource and return one or more parameter values
@@ -27,7 +27,7 @@ class CollectorTransformer
27
27
  overrides = {
28
28
  :parameters => o.operations.map{ |x| @@evaluator.evaluate(x, scope)}.flatten,
29
29
  :file => o.file,
30
- :line => [o.line, o.pos],
30
+ :line => o.line,
31
31
  :source => scope.source,
32
32
  :scope => scope
33
33
  }
@@ -231,7 +231,7 @@ class EvaluatorImpl
231
231
  values.fetch(lval) {|k| fail(Issues::MISSING_MULTI_ASSIGNMENT_KEY, o, :key =>k)},
232
232
  o, scope)
233
233
  end
234
- elsif values.is_a?(Puppet::Pops::Types::PHostClassType)
234
+ elsif values.is_a?(Puppet::Pops::Types::PClassType)
235
235
  # assign variables from class variables
236
236
  # lookup class resource and return one or more parameter values
237
237
  # TODO: behavior when class_name is nil
@@ -305,7 +305,7 @@ class EvaluatorImpl
305
305
  nil
306
306
  end
307
307
 
308
- # A QualifiedReference (i.e. a capitalized qualified name such as Foo, or Foo::Bar) evaluates to a PType
308
+ # A QualifiedReference (i.e. a capitalized qualified name such as Foo, or Foo::Bar) evaluates to a PTypeType
309
309
  #
310
310
  def eval_QualifiedReference(o, scope)
311
311
  type = Types::TypeParser.singleton.interpret(o)
@@ -479,7 +479,7 @@ class EvaluatorImpl
479
479
  def eval_AccessExpression(o, scope)
480
480
  left = evaluate(o.left_expr, scope)
481
481
  keys = o.keys || []
482
- if left.is_a?(Types::PHostClassType)
482
+ if left.is_a?(Types::PClassType)
483
483
  # Evaluate qualified references without errors no undefined types
484
484
  keys = keys.map {|key| key.is_a?(Model::QualifiedReference) ? Types::TypeParser.singleton.interpret(key) : evaluate(key, scope) }
485
485
  else
@@ -755,7 +755,7 @@ class EvaluatorImpl
755
755
 
756
756
  # must be a CatalogEntry subtype
757
757
  case evaluated_name
758
- when Types::PHostClassType
758
+ when Types::PClassType
759
759
  unless evaluated_name.class_name.nil?
760
760
  fail(Issues::ILLEGAL_RESOURCE_TYPE, o.type_name, {:actual=> evaluated_name.to_s})
761
761
  end
@@ -91,7 +91,7 @@ class RelationshipOperator
91
91
  end
92
92
 
93
93
  # Asserts (and returns) the type if it is a PCatalogEntryType
94
- # (A PCatalogEntryType is the base class of PHostClassType, and PResourceType).
94
+ # (A PCatalogEntryType is the base class of PClassType, and PResourceType).
95
95
  #
96
96
  def assert_catalog_type(o, scope)
97
97
  unless @type_calculator.assignable?(@catalog_type, o)
@@ -127,9 +127,9 @@ class Runtime3Converter
127
127
  # Ensures that resources are *not* absolute.
128
128
  #
129
129
  def catalog_type_to_split_type_title(catalog_type)
130
- split_type = catalog_type.is_a?(Puppet::Pops::Types::PType) ? catalog_type.type : catalog_type
130
+ split_type = catalog_type.is_a?(Puppet::Pops::Types::PTypeType) ? catalog_type.type : catalog_type
131
131
  case split_type
132
- when Puppet::Pops::Types::PHostClassType
132
+ when Puppet::Pops::Types::PClassType
133
133
  class_name = split_type.class_name
134
134
  ['class', class_name.nil? ? nil : class_name.sub(/^::/, '')]
135
135
  when Puppet::Pops::Types::PResourceType
@@ -143,7 +143,7 @@ class Runtime3Converter
143
143
  [type_name.nil? ? nil : type_name.sub(/^::/, '').downcase, title.nil? ? '' : title]
144
144
  end
145
145
  else
146
- raise ArgumentError, "Cannot split the type #{catalog_type.class}, it represents neither a PHostClassType, nor a PResourceType."
146
+ raise ArgumentError, "Cannot split the type #{catalog_type.class}, it represents neither a PClassType, nor a PResourceType."
147
147
  end
148
148
  end
149
149
 
@@ -60,7 +60,7 @@ module Runtime3ResourceSupport
60
60
  # Classes are evaluated immediately
61
61
  scope.compiler.evaluate_classes([resource_title], scope, false) if resolved_type == CLASS_STRING
62
62
 
63
- # Turn the resource into a PType (a reference to a resource type)
63
+ # Turn the resource into a PTypeType (a reference to a resource type)
64
64
  # weed out nil's
65
65
  resource_to_ptype(resource)
66
66
  end
@@ -179,7 +179,7 @@ module ModuleLoaders
179
179
  if tse && (ts = tse.value).is_a?(Types::PTypeSetType)
180
180
  # The TypeSet might be unresolved at this point. If so, it must be resolved using
181
181
  # this loader. That in turn, adds all contained types to this loader.
182
- ts.resolve(Types::TypeParser.singleton, self)
182
+ ts.resolve(self)
183
183
  te = get_entry(typed_name)
184
184
  return te unless te.nil?
185
185
  end
@@ -141,8 +141,7 @@ class StaticLoader < Loader
141
141
 
142
142
  def register_aliases
143
143
  aliases = BUILTIN_ALIASES.map { |name, string| add_type(name, Types::PTypeAliasType.new(name, Types::TypeFactory.type_reference(string), nil)) }
144
- parser = Types::TypeParser.singleton
145
- aliases.each { |type| type.resolve(parser, self) }
144
+ aliases.each { |type| type.resolve(self) }
146
145
  end
147
146
  end
148
147
  end
@@ -110,8 +110,7 @@ class Loaders
110
110
  type
111
111
  end
112
112
  # Resolve lazy so that all types can cross reference each other
113
- parser = Types::TypeParser.singleton
114
- types.each { |type| type.resolve(parser, loader) }
113
+ types.each { |type| type.resolve(loader) }
115
114
  end
116
115
 
117
116
  # Register the given type with the Runtime3TypeLoader. The registration will not happen unless
@@ -157,7 +157,7 @@ class Context
157
157
  tf.callable([0, 0], tf.iterable(tf.tuple([key_type, tf.any])))),
158
158
  'cached_file_data' => tf.callable(tf.string, tf.optional(tf.callable([1, 1])))
159
159
  }
160
- ).resolve(Types::TypeParser.singleton, loader)
160
+ ).resolve(loader)
161
161
  end
162
162
 
163
163
  # Mainly for test purposes. Makes it possible to create a {Context} in Puppet code provided that a current {Invocation} exists.