puppet 4.10.1 → 4.10.4

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 (120) hide show
  1. data/ext/project_data.yaml +1 -1
  2. data/lib/puppet.rb +40 -28
  3. data/lib/puppet/application/agent.rb +1 -1
  4. data/lib/puppet/application/apply.rb +1 -1
  5. data/lib/puppet/application/cert.rb +1 -1
  6. data/lib/puppet/application/describe.rb +1 -1
  7. data/lib/puppet/application/device.rb +1 -1
  8. data/lib/puppet/application/doc.rb +3 -3
  9. data/lib/puppet/application/filebucket.rb +1 -1
  10. data/lib/puppet/application/inspect.rb +2 -2
  11. data/lib/puppet/application/lookup.rb +1 -1
  12. data/lib/puppet/application/master.rb +1 -1
  13. data/lib/puppet/application/resource.rb +7 -7
  14. data/lib/puppet/defaults.rb +1 -1
  15. data/lib/puppet/etc.rb +75 -39
  16. data/lib/puppet/face/ca.rb +1 -1
  17. data/lib/puppet/face/catalog.rb +1 -1
  18. data/lib/puppet/face/certificate.rb +1 -1
  19. data/lib/puppet/face/certificate_request.rb +1 -1
  20. data/lib/puppet/face/certificate_revocation_list.rb +1 -1
  21. data/lib/puppet/face/config.rb +1 -1
  22. data/lib/puppet/face/epp.rb +1 -1
  23. data/lib/puppet/face/facts.rb +1 -1
  24. data/lib/puppet/face/file.rb +1 -1
  25. data/lib/puppet/face/help.rb +1 -1
  26. data/lib/puppet/face/key.rb +1 -1
  27. data/lib/puppet/face/man.rb +2 -2
  28. data/lib/puppet/face/module.rb +1 -1
  29. data/lib/puppet/face/node.rb +1 -1
  30. data/lib/puppet/face/parser.rb +1 -1
  31. data/lib/puppet/face/plugin.rb +1 -1
  32. data/lib/puppet/face/report.rb +1 -1
  33. data/lib/puppet/face/resource.rb +1 -1
  34. data/lib/puppet/face/resource_type.rb +1 -1
  35. data/lib/puppet/face/status.rb +1 -1
  36. data/lib/puppet/feature/base.rb +1 -1
  37. data/lib/puppet/functions/eyaml_lookup_key.rb +16 -12
  38. data/lib/puppet/functions/hiera.rb +9 -2
  39. data/lib/puppet/functions/hiera_array.rb +9 -2
  40. data/lib/puppet/functions/hiera_hash.rb +10 -2
  41. data/lib/puppet/functions/hiera_include.rb +17 -3
  42. data/lib/puppet/functions/hocon_data.rb +6 -0
  43. data/lib/puppet/functions/json_data.rb +4 -0
  44. data/lib/puppet/functions/yaml_data.rb +4 -0
  45. data/lib/puppet/generate/models/type/type.rb +6 -5
  46. data/lib/puppet/generate/templates/type/pcore.erb +1 -1
  47. data/lib/puppet/module_tool/skeleton/templates/generator/examples/init.pp.erb +1 -1
  48. data/lib/puppet/parser/functions/create_resources.rb +8 -0
  49. data/lib/puppet/parser/scope.rb +2 -2
  50. data/lib/puppet/pops/adapters.rb +10 -4
  51. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +0 -2
  52. data/lib/puppet/pops/evaluator/runtime3_support.rb +31 -0
  53. data/lib/puppet/pops/issues.rb +8 -0
  54. data/lib/puppet/pops/loader/loader.rb +4 -0
  55. data/lib/puppet/pops/loader/module_loaders.rb +0 -2
  56. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  57. data/lib/puppet/pops/loader/type_definition_instantiator.rb +1 -1
  58. data/lib/puppet/pops/loader/typed_name.rb +1 -0
  59. data/lib/puppet/pops/loaders.rb +7 -15
  60. data/lib/puppet/pops/lookup/environment_data_provider.rb +1 -1
  61. data/lib/puppet/pops/lookup/hiera_config.rb +3 -1
  62. data/lib/puppet/pops/lookup/interpolation.rb +2 -1
  63. data/lib/puppet/pops/lookup/lookup_key.rb +1 -1
  64. data/lib/puppet/pops/lookup/module_data_provider.rb +10 -2
  65. data/lib/puppet/pops/lookup/sub_lookup.rb +10 -9
  66. data/lib/puppet/pops/parser/lexer2.rb +20 -3
  67. data/lib/puppet/pops/pcore.rb +2 -2
  68. data/lib/puppet/pops/resource/resource_type_impl.rb +2 -2
  69. data/lib/puppet/pops/semantic_error.rb +12 -0
  70. data/lib/puppet/pops/serialization/deserializer.rb +7 -4
  71. data/lib/puppet/pops/types/p_type_set_type.rb +2 -2
  72. data/lib/puppet/pops/types/string_converter.rb +5 -17
  73. data/lib/puppet/pops/types/type_set_reference.rb +1 -1
  74. data/lib/puppet/pops/validation/checker4_0.rb +4 -0
  75. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
  76. data/lib/puppet/provider/nameservice.rb +12 -4
  77. data/lib/puppet/provider/package/yum.rb +8 -8
  78. data/lib/puppet/provider/user/useradd.rb +1 -1
  79. data/lib/puppet/reference/configuration.rb +1 -1
  80. data/lib/puppet/resource.rb +9 -11
  81. data/lib/puppet/resource/type_collection.rb +1 -0
  82. data/lib/puppet/type/exec.rb +32 -26
  83. data/lib/puppet/type/file/mode.rb +4 -0
  84. data/lib/puppet/util/character_encoding.rb +77 -74
  85. data/lib/puppet/util/monkey_patches.rb +3 -1
  86. data/lib/puppet/util/windows/api_types.rb +3 -0
  87. data/lib/puppet/util/windows/file.rb +1 -1
  88. data/lib/puppet/version.rb +1 -1
  89. data/locales/puppet.pot +31 -7
  90. data/spec/integration/faces/documentation_spec.rb +2 -2
  91. data/spec/integration/parser/pcore_resource_spec.rb +15 -0
  92. data/spec/integration/resource/type_collection_spec.rb +6 -0
  93. data/spec/lib/puppet/face/1.0.0/huzzah.rb +1 -1
  94. data/spec/lib/puppet/face/basetest.rb +1 -1
  95. data/spec/lib/puppet/face/huzzah.rb +1 -1
  96. data/spec/lib/puppet/face/version_matching.rb +1 -1
  97. data/spec/lib/puppet_spec/character_encoding.rb +12 -0
  98. data/spec/lib/puppet_spec/compiler.rb +7 -0
  99. data/spec/shared_examples/rhel_package_provider.rb +10 -11
  100. data/spec/unit/application/resource_spec.rb +22 -1
  101. data/spec/unit/configurer/fact_handler_spec.rb +2 -1
  102. data/spec/unit/etc_spec.rb +361 -153
  103. data/spec/unit/functions/lookup_spec.rb +118 -2
  104. data/spec/unit/parser/functions/create_resources_spec.rb +47 -6
  105. data/spec/unit/parser/scope_spec.rb +8 -0
  106. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +40 -0
  107. data/spec/unit/pops/loaders/loaders_spec.rb +141 -79
  108. data/spec/unit/pops/lookup/interpolation_spec.rb +49 -9
  109. data/spec/unit/pops/lookup/lookup_spec.rb +32 -0
  110. data/spec/unit/pops/parser/lexer2_spec.rb +28 -0
  111. data/spec/unit/pops/types/p_object_type_spec.rb +1 -1
  112. data/spec/unit/pops/types/p_type_set_type_spec.rb +1 -1
  113. data/spec/unit/pops/types/string_converter_spec.rb +21 -0
  114. data/spec/unit/pops/validator/validator_spec.rb +43 -0
  115. data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -0
  116. data/spec/unit/provider/nameservice_spec.rb +113 -3
  117. data/spec/unit/provider/user/useradd_spec.rb +13 -0
  118. data/spec/unit/resource/catalog_spec.rb +21 -0
  119. data/spec/unit/util/character_encoding_spec.rb +193 -52
  120. metadata +4 -2
@@ -1,7 +1,7 @@
1
1
  require 'puppet/face'
2
2
 
3
3
  Puppet::Face.define(:ca, '0.1.0') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Local Puppet Certificate Authority management."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:catalog, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Compile, save, view, and convert catalogs."
@@ -2,7 +2,7 @@ require 'puppet/indirector/face'
2
2
  require 'puppet/ssl/host'
3
3
 
4
4
  Puppet::Indirector::Face.define(:certificate, '0.0.1') do
5
- copyright "Puppet Labs", 2011
5
+ copyright "Puppet Inc.", 2011
6
6
  license "Apache 2 license; see COPYING"
7
7
 
8
8
  summary "Provide access to the CA for certificate management."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Manage certificate requests."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Manage the list of revoked certificates."
@@ -2,7 +2,7 @@ require 'puppet/face'
2
2
  require 'puppet/settings/ini_file'
3
3
 
4
4
  Puppet::Face.define(:config, '0.0.1') do
5
- copyright "Puppet Labs", 2011
5
+ copyright "Puppet Inc.", 2011
6
6
  license "Apache 2 license; see COPYING"
7
7
 
8
8
  summary "Interact with Puppet's settings."
@@ -4,7 +4,7 @@ require 'puppet/parser/files'
4
4
  require 'puppet/file_system'
5
5
 
6
6
  Puppet::Face.define(:epp, '0.0.1') do
7
- copyright "Puppet Labs", 2014
7
+ copyright "Puppet Inc.", 2014
8
8
  license "Apache 2 license; see COPYING"
9
9
 
10
10
  summary "Interact directly with the EPP template parser/renderer."
@@ -2,7 +2,7 @@ require 'puppet/indirector/face'
2
2
  require 'puppet/node/facts'
3
3
 
4
4
  Puppet::Indirector::Face.define(:facts, '0.0.1') do
5
- copyright "Puppet Labs", 2011
5
+ copyright "Puppet Inc.", 2011
6
6
  license "Apache 2 license; see COPYING"
7
7
 
8
8
  summary "Retrieve and store facts."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:file, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Retrieve and store files in a filebucket"
@@ -5,7 +5,7 @@ require 'pathname'
5
5
  require 'erb'
6
6
 
7
7
  Puppet::Face.define(:help, '0.0.1') do
8
- copyright "Puppet Labs", 2011
8
+ copyright "Puppet Inc.", 2011
9
9
  license _("Apache 2 license; see COPYING")
10
10
 
11
11
  summary _("Display Puppet help.")
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:key, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Create, save, and remove certificate keys."
@@ -4,7 +4,7 @@ require 'pathname'
4
4
  require 'erb'
5
5
 
6
6
  Puppet::Face.define(:man, '0.0.1') do
7
- copyright "Puppet Labs", 2011
7
+ copyright "Puppet Inc.", 2011
8
8
  license "Apache 2 license; see COPYING"
9
9
 
10
10
  summary "Display Puppet manual pages."
@@ -75,7 +75,7 @@ Puppet::Face.define(:man, '0.0.1') do
75
75
  # ronn is a stupid about pager selection, we can be smarter. :)
76
76
  if pager then ENV['PAGER'] = pager end
77
77
 
78
- args = "--man --manual='Puppet Manual' --organization='Puppet Labs, LLC'"
78
+ args = "--man --manual='Puppet Manual' --organization='Puppet Inc., LLC'"
79
79
  # manual pages could contain UTF-8 text
80
80
  IO.popen("#{ronn} #{args}", 'w:UTF-8') do |fh| fh.write text end
81
81
 
@@ -5,7 +5,7 @@ require 'puppet/util/colors'
5
5
  Puppet::Face.define(:module, '1.0.0') do
6
6
  extend Puppet::Util::Colors
7
7
 
8
- copyright "Puppet Labs", 2012
8
+ copyright "Puppet Inc.", 2012
9
9
  license "Apache 2 license; see COPYING"
10
10
 
11
11
  summary "Creates, installs and searches for modules on the Puppet Forge."
@@ -1,6 +1,6 @@
1
1
  require 'puppet/indirector/face'
2
2
  Puppet::Indirector::Face.define(:node, '0.0.1') do
3
- copyright "Puppet Labs", 2011
3
+ copyright "Puppet Inc.", 2011
4
4
  license "Apache 2 license; see COPYING"
5
5
 
6
6
  summary "View and manage node definitions."
@@ -2,7 +2,7 @@ require 'puppet/face'
2
2
  require 'puppet/parser'
3
3
 
4
4
  Puppet::Face.define(:parser, '0.0.1') do
5
- copyright "Puppet Labs", 2014
5
+ copyright "Puppet Inc.", 2014
6
6
  license "Apache 2 license; see COPYING"
7
7
 
8
8
  summary "Interact directly with the parser."
@@ -3,7 +3,7 @@ require 'puppet/configurer/downloader_factory'
3
3
  require 'puppet/configurer/plugin_handler'
4
4
 
5
5
  Puppet::Face.define(:plugin, '0.0.1') do
6
- copyright "Puppet Labs", 2011
6
+ copyright "Puppet Inc.", 2011
7
7
  license "Apache 2 license; see COPYING"
8
8
 
9
9
  summary "Interact with the Puppet plugin system."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:report, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "Create, display, and submit reports."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:resource, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "API only: interact directly with resources via the RAL."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:resource_type, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "View classes, defined resource types, and nodes from all manifests."
@@ -1,7 +1,7 @@
1
1
  require 'puppet/indirector/face'
2
2
 
3
3
  Puppet::Indirector::Face.define(:status, '0.0.1') do
4
- copyright "Puppet Labs", 2011
4
+ copyright "Puppet Inc.", 2011
5
5
  license "Apache 2 license; see COPYING"
6
6
 
7
7
  summary "View puppet server status."
@@ -79,7 +79,7 @@ Puppet.features.add(:manages_symlinks) do
79
79
  def self.is_implemented
80
80
  begin
81
81
  ffi_lib :kernel32
82
- attach_function :CreateSymbolicLinkW, [:lpwstr, :lpwstr, :dword], :win32_bool
82
+ attach_function :CreateSymbolicLinkW, [:lpwstr, :lpwstr, :dword], :boolean
83
83
 
84
84
  true
85
85
  rescue LoadError => err
@@ -1,3 +1,7 @@
1
+ # The `eyaml_lookup_key` is a hiera 5 `lookup_key` data provider function.
2
+ # See [the configuration guide documentation](https://docs.puppet.com/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-hiera-eyaml) for
3
+ # how to use this function.
4
+ #
1
5
  # @since 5.0.0
2
6
  #
3
7
  Puppet::Functions.create_function(:eyaml_lookup_key) do
@@ -29,17 +33,11 @@ Puppet::Functions.create_function(:eyaml_lookup_key) do
29
33
  # nil key is used to indicate that the cache contains the raw content of the eyaml file
30
34
  raw_data = context.cached_value(nil)
31
35
  if raw_data.nil?
32
- options.each_pair do |k, v|
33
- unless k == 'path'
34
- Hiera::Backend::Eyaml::Options[k.to_sym] = v
35
- context.explain { "Setting Eyaml option '#{k}' to '#{v}'" }
36
- end
37
- end
38
36
  raw_data = load_data_hash(options, context)
39
37
  context.cache(nil, raw_data)
40
38
  end
41
39
  context.not_found unless raw_data.include?(key)
42
- context.cache(key, decrypt_value(raw_data[key], context))
40
+ context.cache(key, decrypt_value(raw_data[key], context, options))
43
41
  end
44
42
 
45
43
  def load_data_hash(options, context)
@@ -61,23 +59,29 @@ Puppet::Functions.create_function(:eyaml_lookup_key) do
61
59
  end
62
60
  end
63
61
 
64
- def decrypt_value(value, context)
62
+ def decrypt_value(value, context, options)
65
63
  case value
66
64
  when String
67
- decrypt(value, context)
65
+ decrypt(value, context, options)
68
66
  when Hash
69
67
  result = {}
70
- value.each_pair { |k, v| result[context.interpolate(k)] = decrypt_value(v, context) }
68
+ value.each_pair { |k, v| result[context.interpolate(k)] = decrypt_value(v, context, options) }
71
69
  result
72
70
  when Array
73
- value.map { |v| decrypt_value(v, context) }
71
+ value.map { |v| decrypt_value(v, context, options) }
74
72
  else
75
73
  value
76
74
  end
77
75
  end
78
76
 
79
- def decrypt(data, context)
77
+ def decrypt(data, context, options)
80
78
  if encrypted?(data)
79
+ # Options must be set prior to each call to #parse since they end up as static variables in
80
+ # the Options class. They cannot be set once before #decrypt_value is called, since each #decrypt
81
+ # might cause a new lookup through interpolation. That lookup in turn, might use a different eyaml
82
+ # config.
83
+ #
84
+ Hiera::Backend::Eyaml::Options.set(options)
81
85
  tokens = Hiera::Backend::Eyaml::Parser::ParserFactory.hiera_backend_parser.parse(data)
82
86
  data = tokens.map(&:to_plain_text).join.chomp
83
87
  end
@@ -2,6 +2,11 @@ require 'hiera/puppet_function'
2
2
  # Performs a standard priority lookup of the hierarchy and returns the most specific value
3
3
  # for a given key. The returned value can be any type of data.
4
4
  #
5
+ # This function is deprecated in favor of the `lookup` function. While this function
6
+ # continues to work, it does **not** support:
7
+ # * `lookup_options` stored in the data
8
+ # * lookup across global, environment, and module layers
9
+ #
5
10
  # The function takes up to three arguments, in this order:
6
11
  #
7
12
  # 1. A string key that Hiera searches for in the hierarchy. **Required**.
@@ -71,8 +76,10 @@ require 'hiera/puppet_function'
71
76
  # above, Hiera matches the 'users' key and returns it as a hash.
72
77
  #
73
78
  # See
74
- # [the documentation](https://docs.puppetlabs.com/hiera/latest/puppet.html#hiera-lookup-functions)
75
- # for more information about Hiera lookup functions.
79
+ # [the 'Using the lookup function' documentation](https://docs.puppet.com/puppet/latest/hiera_use_function.html) for how to perform lookup of data.
80
+ # Also see
81
+ # [the 'Using the deprecated hiera functions' documentation](https://docs.puppet.com/puppet/latest/hiera_use_hiera_functions.html)
82
+ # for more information about the Hiera 3 functions.
76
83
  #
77
84
  # @since 4.0.0
78
85
  #
@@ -5,6 +5,11 @@ require 'hiera/puppet_function'
5
5
  # included in the results. This is called an
6
6
  # [array merge lookup](https://docs.puppetlabs.com/hiera/latest/lookup_types.html#array-merge).
7
7
  #
8
+ # This function is deprecated in favor of the `lookup` function. While this function
9
+ # continues to work, it does **not** support:
10
+ # * `lookup_options` stored in the data
11
+ # * lookup across global, environment, and module layers
12
+ #
8
13
  # The `hiera_array` function takes up to three arguments, in this order:
9
14
  #
10
15
  # 1. A string key that Hiera searches for in the hierarchy. **Required**.
@@ -60,8 +65,10 @@ require 'hiera/puppet_function'
60
65
  # value is a hash, Puppet raises a type mismatch error.
61
66
  #
62
67
  # See
63
- # [the documentation](https://docs.puppetlabs.com/hiera/latest/puppet.html#hiera-lookup-functions)
64
- # for more information about Hiera lookup functions.
68
+ # [the 'Using the lookup function' documentation](https://docs.puppet.com/puppet/latest/hiera_use_function.html) for how to perform lookup of data.
69
+ # Also see
70
+ # [the 'Using the deprecated hiera functions' documentation](https://docs.puppet.com/puppet/latest/hiera_use_hiera_functions.html)
71
+ # for more information about the Hiera 3 functions.
65
72
  #
66
73
  # @since 4.0.0
67
74
  #
@@ -1,6 +1,12 @@
1
1
  require 'hiera/puppet_function'
2
2
 
3
3
  # Finds all matches of a key throughout the hierarchy and returns them in a merged hash.
4
+ #
5
+ # This function is deprecated in favor of the `lookup` function. While this function
6
+ # continues to work, it does **not** support:
7
+ # * `lookup_options` stored in the data
8
+ # * lookup across global, environment, and module layers
9
+ #
4
10
  # If any of the matched hashes share keys, the final hash uses the value from the
5
11
  # highest priority match. This is called a
6
12
  # [hash merge lookup](https://docs.puppetlabs.com/hiera/latest/lookup_types.html#hash-merge).
@@ -70,8 +76,10 @@ require 'hiera/puppet_function'
70
76
  # found in the data sources are strings or arrays, Puppet raises a type mismatch error.
71
77
  #
72
78
  # See
73
- # [the documentation](https://docs.puppetlabs.com/hiera/latest/puppet.html#hiera-lookup-functions)
74
- # for more information about Hiera lookup functions.
79
+ # [the 'Using the lookup function' documentation](https://docs.puppet.com/puppet/latest/hiera_use_function.html) for how to perform lookup of data.
80
+ # Also see
81
+ # [the 'Using the deprecated hiera functions' documentation](https://docs.puppet.com/puppet/latest/hiera_use_hiera_functions.html)
82
+ # for more information about the Hiera 3 functions.
75
83
  #
76
84
  # @since 4.0.0
77
85
  #
@@ -4,6 +4,18 @@ require 'hiera/puppet_function'
4
4
  # [array merge lookup](https://docs.puppetlabs.com/hiera/latest/lookup_types.html#array-merge)
5
5
  # that retrieves the value for a user-specified key from Hiera's data.
6
6
  #
7
+ # This function is deprecated in favor of the `lookup` function in combination with `include`.
8
+ # While this function continues to work, it does **not** support:
9
+ # * `lookup_options` stored in the data
10
+ # * lookup across global, environment, and module layers
11
+ #
12
+ # @example Using `lookup` and `include` instead of of the deprecated `hiera_include`
13
+ #
14
+ # ~~~puppet
15
+ # # In site.pp, outside of any node definitions and below any top-scope variables:
16
+ # lookup('classes', Array[String], 'unique').include
17
+ # ~~~
18
+ #
7
19
  # The `hiera_include` function requires:
8
20
  #
9
21
  # - A string key name to use for classes.
@@ -70,9 +82,11 @@ require 'hiera/puppet_function'
70
82
  # # "Key 'classes' not found".
71
83
  # ~~~
72
84
  #
73
- # See [the documentation](http://links.puppetlabs.com/hierainclude) for more information
74
- # and a more detailed example of how `hiera_include` uses array merge lookups to classify
75
- # nodes.
85
+ # See
86
+ # [the 'Using the lookup function' documentation](https://docs.puppet.com/puppet/latest/hiera_use_function.html) for how to perform lookup of data.
87
+ # Also see
88
+ # [the 'Using the deprecated hiera functions' documentation](https://docs.puppet.com/puppet/latest/hiera_use_hiera_functions.html)
89
+ # for more information about the Hiera 3 functions.
76
90
  #
77
91
  # @since 4.0.0
78
92
  #
@@ -1,3 +1,9 @@
1
+ # The `hocon_data` is a hiera 5 `data_hash` data provider function.
2
+ # See [the configuration guide documentation](https://docs.puppet.com/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
3
+ # how to use this function.
4
+ #
5
+ # Note that this function is not supported without a hocon library being present.
6
+ #
1
7
  # @since 4.9.0
2
8
  #
3
9
  Puppet::Functions.create_function(:hocon_data) do
@@ -1,3 +1,7 @@
1
+ # The `json_data` is a hiera 5 `data_hash` data provider function.
2
+ # See [the configuration guide documentation](https://docs.puppet.com/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
3
+ # how to use this function.
4
+ #
1
5
  # @since 4.8.0
2
6
  #
3
7
  Puppet::Functions.create_function(:json_data) do
@@ -1,3 +1,7 @@
1
+ # The `yaml_data` is a hiera 5 `data_hash` data provider function.
2
+ # See [the configuration guide documentation](https://docs.puppet.com/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
3
+ # how to use this function.
4
+ #
1
5
  # @since 4.8.0
2
6
  #
3
7
  require 'yaml'
@@ -37,14 +37,15 @@ module Puppet
37
37
  @parameters = type.parameters.map do |name|
38
38
  Property.new(type.paramclass(name))
39
39
  end
40
+ sc = Puppet::Pops::Types::StringConverter.singleton
40
41
  @title_patterns = Hash[type.title_patterns.map do |mapping|
41
42
  [
42
- "/#{mapping[0].source.gsub(/\//, '\/')}/",
43
- mapping[1].map { |names|
43
+ sc.convert(mapping[0], '%p'),
44
+ sc.convert(mapping[1].map do |names|
44
45
  next if names.empty?
45
- raise Puppet::Error, 'title patterns that use procs are not supported.' if names.size != 1
46
- Puppet::Pops::Types::StringConverter.convert(names[0].to_s, '%p')
47
- }
46
+ raise Puppet::Error, _('title patterns that use procs are not supported.') unless names.size == 1
47
+ names[0].to_s
48
+ end, '%p')
48
49
  ]
49
50
  end]
50
51
  @isomorphic = type.isomorphic?
@@ -34,7 +34,7 @@ Puppet::Resource::ResourceType3.new(
34
34
  ],
35
35
  {
36
36
  <%- title_patterns.each_with_index do |mapping, index| -%>
37
- <%= mapping[0] %> => [<%= mapping[1].join(', ')%>]<%= "," if index + 1 < title_patterns.size %>
37
+ <%= mapping[0] %> => <%= mapping[1] %><%= "," if index + 1 < title_patterns.size %>
38
38
  <%- end -%>
39
39
  },
40
40
  <%= isomorphic -%>,