puppet 4.7.1 → 4.8.0

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 (276) hide show
  1. data/Gemfile +0 -3
  2. data/MAINTAINERS +76 -0
  3. data/README.md +0 -6
  4. data/Rakefile +2 -2
  5. data/lib/puppet/agent.rb +3 -3
  6. data/lib/puppet/application/apply.rb +1 -1
  7. data/lib/puppet/configurer.rb +2 -2
  8. data/lib/puppet/data_providers.rb +1 -0
  9. data/lib/puppet/data_providers/data_adapter.rb +1 -0
  10. data/lib/puppet/data_providers/data_function_support.rb +1 -0
  11. data/lib/puppet/data_providers/function_env_data_provider.rb +1 -0
  12. data/lib/puppet/data_providers/function_module_data_provider.rb +1 -0
  13. data/lib/puppet/data_providers/hiera_config.rb +1 -0
  14. data/lib/puppet/data_providers/hiera_env_data_provider.rb +1 -0
  15. data/lib/puppet/data_providers/hiera_interpolate.rb +1 -0
  16. data/lib/puppet/data_providers/hiera_module_data_provider.rb +1 -0
  17. data/lib/puppet/data_providers/hiera_support.rb +1 -2
  18. data/lib/puppet/data_providers/json_data_provider_factory.rb +2 -0
  19. data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -0
  20. data/lib/puppet/defaults.rb +20 -1
  21. data/lib/puppet/environments.rb +5 -2
  22. data/lib/puppet/face/catalog.rb +1 -1
  23. data/lib/puppet/face/epp.rb +57 -11
  24. data/lib/puppet/face/module/install.rb +6 -6
  25. data/lib/puppet/functions.rb +23 -24
  26. data/lib/puppet/functions/alert.rb +14 -0
  27. data/lib/puppet/functions/binary_file.rb +25 -0
  28. data/lib/puppet/functions/break.rb +22 -0
  29. data/lib/puppet/functions/contain.rb +33 -0
  30. data/lib/puppet/functions/crit.rb +14 -0
  31. data/lib/puppet/functions/debug.rb +14 -0
  32. data/lib/puppet/functions/emerg.rb +14 -0
  33. data/lib/puppet/functions/epp.rb +1 -1
  34. data/lib/puppet/functions/err.rb +14 -0
  35. data/lib/puppet/functions/find_file.rb +31 -0
  36. data/lib/puppet/functions/include.rb +21 -0
  37. data/lib/puppet/functions/info.rb +14 -0
  38. data/lib/puppet/functions/new.rb +1 -1
  39. data/lib/puppet/functions/next.rb +23 -0
  40. data/lib/puppet/functions/notice.rb +14 -0
  41. data/lib/puppet/functions/regsubst.rb +12 -16
  42. data/lib/puppet/functions/require.rb +37 -0
  43. data/lib/puppet/functions/return.rb +22 -0
  44. data/lib/puppet/functions/strftime.rb +35 -0
  45. data/lib/puppet/functions/warning.rb +14 -0
  46. data/lib/puppet/generate/models/type/type.rb +4 -0
  47. data/lib/puppet/generate/templates/type/pcore.erb +2 -1
  48. data/lib/puppet/indirector/face.rb +6 -1
  49. data/lib/puppet/network/http/error.rb +2 -2
  50. data/lib/puppet/network/http/handler.rb +2 -2
  51. data/lib/puppet/node/environment.rb +11 -0
  52. data/lib/puppet/parser/ast.rb +5 -0
  53. data/lib/puppet/parser/ast/pops_bridge.rb +17 -4
  54. data/lib/puppet/parser/compiler.rb +29 -1
  55. data/lib/puppet/parser/functions.rb +6 -0
  56. data/lib/puppet/parser/functions/assert_type.rb +1 -1
  57. data/lib/puppet/parser/functions/binary_file.rb +24 -0
  58. data/lib/puppet/parser/functions/break.rb +39 -0
  59. data/lib/puppet/parser/functions/contain.rb +7 -15
  60. data/lib/puppet/parser/functions/defined.rb +2 -2
  61. data/lib/puppet/parser/functions/dig.rb +1 -1
  62. data/lib/puppet/parser/functions/each.rb +1 -1
  63. data/lib/puppet/parser/functions/epp.rb +2 -2
  64. data/lib/puppet/parser/functions/filter.rb +1 -1
  65. data/lib/puppet/parser/functions/find_file.rb +28 -0
  66. data/lib/puppet/parser/functions/hiera.rb +4 -4
  67. data/lib/puppet/parser/functions/hiera_array.rb +1 -1
  68. data/lib/puppet/parser/functions/hiera_hash.rb +1 -1
  69. data/lib/puppet/parser/functions/hiera_include.rb +1 -1
  70. data/lib/puppet/parser/functions/include.rb +4 -8
  71. data/lib/puppet/parser/functions/inline_epp.rb +1 -1
  72. data/lib/puppet/parser/functions/lest.rb +1 -1
  73. data/lib/puppet/parser/functions/lookup.rb +4 -2
  74. data/lib/puppet/parser/functions/map.rb +1 -1
  75. data/lib/puppet/parser/functions/match.rb +1 -1
  76. data/lib/puppet/parser/functions/new.rb +414 -18
  77. data/lib/puppet/parser/functions/next.rb +38 -0
  78. data/lib/puppet/parser/functions/reduce.rb +1 -1
  79. data/lib/puppet/parser/functions/regsubst.rb +4 -2
  80. data/lib/puppet/parser/functions/require.rb +4 -27
  81. data/lib/puppet/parser/functions/return.rb +71 -0
  82. data/lib/puppet/parser/functions/reverse_each.rb +1 -1
  83. data/lib/puppet/parser/functions/scanf.rb +13 -8
  84. data/lib/puppet/parser/functions/slice.rb +1 -1
  85. data/lib/puppet/parser/functions/split.rb +1 -1
  86. data/lib/puppet/parser/functions/step.rb +1 -1
  87. data/lib/puppet/parser/functions/strftime.rb +185 -0
  88. data/lib/puppet/parser/functions/then.rb +1 -1
  89. data/lib/puppet/parser/functions/type.rb +1 -1
  90. data/lib/puppet/parser/functions/with.rb +3 -3
  91. data/lib/puppet/parser/resource.rb +8 -5
  92. data/lib/puppet/parser/scope.rb +1 -1
  93. data/lib/puppet/plugins/configuration.rb +8 -0
  94. data/lib/puppet/plugins/data_providers.rb +1 -0
  95. data/lib/puppet/plugins/data_providers/data_provider.rb +7 -28
  96. data/lib/puppet/plugins/data_providers/registry.rb +1 -0
  97. data/lib/puppet/pops.rb +4 -0
  98. data/lib/puppet/pops/evaluator/access_operator.rb +36 -5
  99. data/lib/puppet/pops/evaluator/closure.rb +81 -12
  100. data/lib/puppet/pops/evaluator/compare_operator.rb +24 -1
  101. data/lib/puppet/pops/evaluator/evaluator_impl.rb +29 -5
  102. data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +1 -1
  103. data/lib/puppet/pops/evaluator/runtime3_converter.rb +53 -62
  104. data/lib/puppet/pops/evaluator/runtime3_support.rb +15 -6
  105. data/lib/puppet/pops/functions/dispatch.rb +9 -2
  106. data/lib/puppet/pops/functions/dispatcher.rb +3 -1
  107. data/lib/puppet/pops/functions/function.rb +19 -2
  108. data/lib/puppet/pops/issues.rb +9 -0
  109. data/lib/puppet/pops/label_provider.rb +2 -2
  110. data/lib/puppet/pops/loader/loader.rb +17 -0
  111. data/lib/puppet/pops/loader/static_loader.rb +0 -41
  112. data/lib/puppet/pops/lookup.rb +12 -0
  113. data/lib/puppet/pops/lookup/context.rb +86 -0
  114. data/lib/puppet/pops/lookup/explainer.rb +46 -6
  115. data/lib/puppet/pops/lookup/invocation.rb +19 -0
  116. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  117. data/lib/puppet/pops/model/factory.rb +20 -8
  118. data/lib/puppet/pops/model/model_label_provider.rb +3 -0
  119. data/lib/puppet/pops/model/model_meta.rb +2 -0
  120. data/lib/puppet/pops/model/model_tree_dumper.rb +14 -0
  121. data/lib/puppet/pops/parser/egrammar.ra +11 -6
  122. data/lib/puppet/pops/parser/eparser.rb +1112 -1086
  123. data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
  124. data/lib/puppet/pops/pcore.rb +1 -0
  125. data/lib/puppet/pops/puppet_stack.rb +3 -3
  126. data/lib/puppet/pops/resource/param.rb +5 -1
  127. data/lib/puppet/pops/resource/resource_type_impl.rb +8 -4
  128. data/lib/puppet/pops/resource/resource_type_set.pcore +1 -0
  129. data/lib/puppet/pops/serialization/abstract_reader.rb +19 -2
  130. data/lib/puppet/pops/serialization/abstract_writer.rb +16 -3
  131. data/lib/puppet/pops/serialization/deserializer.rb +5 -1
  132. data/lib/puppet/pops/serialization/extension.rb +2 -0
  133. data/lib/puppet/pops/serialization/json.rb +76 -26
  134. data/lib/puppet/pops/serialization/serializer.rb +5 -1
  135. data/lib/puppet/pops/serialization/time_factory.rb +2 -1
  136. data/lib/puppet/pops/time/timespan.rb +718 -0
  137. data/lib/puppet/pops/time/timestamp.rb +148 -0
  138. data/lib/puppet/pops/types/p_binary_type.rb +220 -0
  139. data/lib/puppet/pops/types/p_object_type.rb +12 -6
  140. data/lib/puppet/pops/types/p_sensitive_type.rb +5 -1
  141. data/lib/puppet/pops/types/p_timespan_type.rb +141 -0
  142. data/lib/puppet/pops/types/p_timestamp_type.rb +69 -0
  143. data/lib/puppet/pops/types/string_converter.rb +62 -0
  144. data/lib/puppet/pops/types/type_asserter.rb +1 -1
  145. data/lib/puppet/pops/types/type_calculator.rb +17 -3
  146. data/lib/puppet/pops/types/type_factory.rb +35 -1
  147. data/lib/puppet/pops/types/type_formatter.rb +64 -11
  148. data/lib/puppet/pops/types/type_mismatch_describer.rb +110 -61
  149. data/lib/puppet/pops/types/type_parser.rb +18 -4
  150. data/lib/puppet/pops/types/types.rb +98 -63
  151. data/lib/puppet/pops/validation.rb +9 -1
  152. data/lib/puppet/pops/validation/checker4_0.rb +7 -0
  153. data/lib/puppet/property.rb +1 -1
  154. data/lib/puppet/provider.rb +3 -6
  155. data/lib/puppet/provider/mcx/mcxcontent.rb +1 -1
  156. data/lib/puppet/provider/mount/parsed.rb +18 -4
  157. data/lib/puppet/provider/nameservice/directoryservice.rb +15 -7
  158. data/lib/puppet/provider/package/gem.rb +6 -1
  159. data/lib/puppet/provider/package/pip.rb +0 -1
  160. data/lib/puppet/provider/package/pkg.rb +5 -1
  161. data/lib/puppet/provider/package/pkgng.rb +1 -1
  162. data/lib/puppet/provider/package/yum.rb +10 -0
  163. data/lib/puppet/provider/service/launchd.rb +1 -0
  164. data/lib/puppet/provider/user/directoryservice.rb +6 -6
  165. data/lib/puppet/provider/yumrepo/inifile.rb +1 -1
  166. data/lib/puppet/provider/zpool/zpool.rb +1 -1
  167. data/lib/puppet/resource.rb +54 -12
  168. data/lib/puppet/resource/capability_finder.rb +15 -9
  169. data/lib/puppet/resource/catalog.rb +25 -6
  170. data/lib/puppet/resource/type.rb +3 -1
  171. data/lib/puppet/settings.rb +1 -1
  172. data/lib/puppet/settings/environment_conf.rb +12 -4
  173. data/lib/puppet/syntax_checkers/base64.rb +41 -0
  174. data/lib/puppet/syntax_checkers/json.rb +0 -2
  175. data/lib/puppet/transaction.rb +6 -0
  176. data/lib/puppet/transaction/additional_resource_generator.rb +5 -0
  177. data/lib/puppet/transaction/report.rb +7 -2
  178. data/lib/puppet/type.rb +2 -1
  179. data/lib/puppet/type/file/checksum.rb +1 -0
  180. data/lib/puppet/type/file/content.rb +4 -4
  181. data/lib/puppet/type/mount.rb +44 -0
  182. data/lib/puppet/type/ssh_authorized_key.rb +1 -1
  183. data/lib/puppet/type/tidy.rb +3 -0
  184. data/lib/puppet/type/user.rb +12 -6
  185. data/lib/puppet/util/log.rb +25 -0
  186. data/lib/puppet/util/plist.rb +8 -3
  187. data/lib/puppet/version.rb +1 -1
  188. data/lib/puppet_x.rb +7 -1
  189. data/spec/integration/application/apply_spec.rb +118 -0
  190. data/spec/integration/parser/compiler_spec.rb +28 -0
  191. data/spec/integration/parser/pcore_resource_spec.rb +40 -3
  192. data/spec/integration/provider/mount_spec.rb +2 -1
  193. data/spec/integration/util/windows/principal_spec.rb +2 -2
  194. data/spec/integration/util/windows/registry_spec.rb +4 -4
  195. data/spec/lib/puppet_spec/compiler.rb +5 -1
  196. data/spec/lib/puppet_spec/unindent.rb +5 -0
  197. data/spec/shared_contexts/types_setup.rb +6 -0
  198. data/spec/shared_examples/rhel_package_provider.rb +16 -0
  199. data/spec/spec_helper.rb +1 -0
  200. data/spec/unit/agent_spec.rb +11 -0
  201. data/spec/unit/application/lookup_spec.rb +94 -3
  202. data/spec/unit/capability_spec.rb +22 -0
  203. data/spec/unit/configurer_spec.rb +8 -0
  204. data/spec/unit/face/epp_face_spec.rb +22 -3
  205. data/spec/unit/functions/assert_type_spec.rb +3 -3
  206. data/spec/unit/functions/binary_file_spec.rb +46 -0
  207. data/spec/unit/functions/break_spec.rb +89 -0
  208. data/spec/unit/{parser/functions → functions}/contain_spec.rb +68 -3
  209. data/spec/unit/functions/find_file_spec.rb +69 -0
  210. data/spec/unit/functions/include_spec.rb +175 -0
  211. data/spec/unit/functions/logging_spec.rb +54 -0
  212. data/spec/unit/functions/lookup_spec.rb +3 -3
  213. data/spec/unit/functions/new_spec.rb +105 -5
  214. data/spec/unit/functions/next_spec.rb +93 -0
  215. data/spec/unit/functions/require_spec.rb +83 -0
  216. data/spec/unit/functions/return_spec.rb +105 -0
  217. data/spec/unit/{parser/functions → functions}/shared.rb +14 -11
  218. data/spec/unit/functions/strftime_spec.rb +152 -0
  219. data/spec/unit/functions4_spec.rb +22 -0
  220. data/spec/unit/indirector/face_spec.rb +10 -2
  221. data/spec/unit/network/http/error_spec.rb +1 -2
  222. data/spec/unit/network/http/handler_spec.rb +6 -5
  223. data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
  224. data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
  225. data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
  226. data/spec/unit/parser/functions/hiera_spec.rb +1 -1
  227. data/spec/unit/parser/functions/lookup_spec.rb +1 -1
  228. data/spec/unit/parser/functions/regsubst_spec.rb +1 -1
  229. data/spec/unit/parser/functions/split_spec.rb +1 -1
  230. data/spec/unit/pops/evaluator/access_ops_spec.rb +81 -1
  231. data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +170 -0
  232. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +29 -4
  233. data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +112 -4
  234. data/spec/unit/pops/loaders/dependency_loader_spec.rb +12 -0
  235. data/spec/unit/pops/loaders/static_loader_spec.rb +0 -26
  236. data/spec/unit/pops/lookup/context_spec.rb +149 -0
  237. data/spec/unit/pops/parser/parse_functions_spec.rb +19 -0
  238. data/spec/unit/pops/parser/parse_lambda_spec.rb +19 -0
  239. data/spec/unit/pops/puppet_stack_spec.rb +1 -1
  240. data/spec/unit/pops/resource/resource_type_impl_spec.rb +74 -0
  241. data/spec/unit/pops/serialization/packer_spec.rb +34 -14
  242. data/spec/unit/pops/serialization/serialization_spec.rb +67 -5
  243. data/spec/unit/pops/time/timespan_spec.rb +121 -0
  244. data/spec/unit/pops/types/p_binary_type_spec.rb +243 -0
  245. data/spec/unit/pops/types/p_object_type_spec.rb +7 -7
  246. data/spec/unit/pops/types/p_sensitive_type_spec.rb +1 -1
  247. data/spec/unit/pops/types/p_timespan_type_spec.rb +273 -0
  248. data/spec/unit/pops/types/p_timestamp_type_spec.rb +311 -0
  249. data/spec/unit/pops/types/p_type_set_type_spec.rb +13 -13
  250. data/spec/unit/pops/types/ruby_generator_spec.rb +12 -12
  251. data/spec/unit/pops/types/string_converter_spec.rb +89 -0
  252. data/spec/unit/pops/types/type_asserter_spec.rb +3 -3
  253. data/spec/unit/pops/types/type_calculator_spec.rb +113 -5
  254. data/spec/unit/pops/types/type_formatter_spec.rb +40 -0
  255. data/spec/unit/pops/types/type_mismatch_describer_spec.rb +49 -38
  256. data/spec/unit/pops/types/type_parser_spec.rb +87 -4
  257. data/spec/unit/pops/types/types_spec.rb +1 -1
  258. data/spec/unit/pops/validator/validator_spec.rb +23 -0
  259. data/spec/unit/provider/mount/parsed_spec.rb +47 -29
  260. data/spec/unit/provider/package/pkg_spec.rb +109 -99
  261. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
  262. data/spec/unit/provider/user/aix_spec.rb +1 -1
  263. data/spec/unit/provider/user/directoryservice_spec.rb +101 -30
  264. data/spec/unit/resource/capability_finder_spec.rb +29 -7
  265. data/spec/unit/resource/catalog_spec.rb +127 -0
  266. data/spec/unit/ssl/certificate_request_spec.rb +1 -1
  267. data/spec/unit/transaction/additional_resource_generator_spec.rb +30 -0
  268. data/spec/unit/transaction/persistence_spec.rb +1 -6
  269. data/spec/unit/transaction/report_spec.rb +23 -0
  270. data/spec/unit/transaction_spec.rb +38 -0
  271. data/spec/unit/type/mount_spec.rb +5 -0
  272. data/spec/unit/util/plist_spec.rb +14 -2
  273. metadata +71 -12
  274. data/spec/integration/parser/functions/require_spec.rb +0 -43
  275. data/spec/unit/parser/functions/include_spec.rb +0 -55
  276. data/spec/unit/parser/functions/require_spec.rb +0 -68
data/Gemfile CHANGED
@@ -53,9 +53,6 @@ group(:development, :test) do
53
53
 
54
54
  gem 'rdoc', "~> 4.1", :platforms => [:ruby]
55
55
 
56
- # webmock requires addressable as as of 2.5.0 addressable started
57
- # requiring the public_suffix gem which requires Ruby 2
58
- gem 'addressable', '< 2.5.0'
59
56
  gem 'webmock', '~> 1.24'
60
57
  gem 'vcr', '~> 2.9'
61
58
  end
@@ -0,0 +1,76 @@
1
+ {
2
+ "version": 1,
3
+ "file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
4
+ "issues": "https://tickets.puppet.com/browse/PUP",
5
+ "internal_list": "https://groups.google.com/a/puppet.com/forum/?hl=en#!forum/discuss-puppet-maintainers",
6
+ "people": [
7
+ {
8
+ "github": "hlindberg",
9
+ "email": "henrik.lindberg@puppet.com",
10
+ "name": "Henrik Lindberg"
11
+ },
12
+ {
13
+ "github": "kylog",
14
+ "email": "kylo@puppet.com",
15
+ "name": "Kylo Ginsberg"
16
+ },
17
+ {
18
+ "github": "joshcooper",
19
+ "email": "josh@puppet.com",
20
+ "name": "Josh Cooper"
21
+ },
22
+ {
23
+ "github": "MikaelSmith",
24
+ "email": "michael.smith@puppet.com",
25
+ "name": "Michael Smith"
26
+ },
27
+ {
28
+ "github": "thallgren",
29
+ "email": "thomas.hallgren@puppet.com",
30
+ "name": "Thomas Hallgren"
31
+ },
32
+ {
33
+ "github": "branan",
34
+ "email": "branan@puppet.com",
35
+ "name": "Branan Riley"
36
+ },
37
+ {
38
+ "github": "whopper",
39
+ "email": "whopper@puppet.com",
40
+ "name": "Will Hopper"
41
+ },
42
+ {
43
+ "github": "Iristyle",
44
+ "name": "Ethan J. Brown"
45
+ },
46
+ {
47
+ "github": "HAIL9000",
48
+ "email": "hailee@puppet.com",
49
+ "name": "Hailee Kenney"
50
+ },
51
+ {
52
+ "github": "er0ck",
53
+ "email": "eric.thompson@puppet.com",
54
+ "name": "Eric Thompson"
55
+ },
56
+ {
57
+ "github": "johnduarte",
58
+ "email": "john.duarte@puppet.com",
59
+ "name": "John Duarte"
60
+ },
61
+ {
62
+ "github": "adrienthebo",
63
+ "name": "Adrien Thebo"
64
+ },
65
+ {
66
+ "github": "jtappa",
67
+ "email": "jorie@puppet.com",
68
+ "name": "Jorie Tappa"
69
+ },
70
+ {
71
+ "github": "MosesMendoza",
72
+ "email": "moses@puppet.com",
73
+ "name": "Moses Mendoza"
74
+ }
75
+ ]
76
+ }
data/README.md CHANGED
@@ -72,9 +72,3 @@ Long-term support, including security patches and bug fixes, is available for
72
72
  commercial customers. Please see the following page for more details:
73
73
 
74
74
  [Puppet Enterprise Support Lifecycle](https://puppetlabs.com/misc/puppet-enterprise-lifecycle)
75
-
76
- Maintainers
77
- -------
78
-
79
- * Kylo Ginsberg, kylo@puppet.com, github:kylog, jira:kylo
80
- * Henrik Lindberg, henrik.lindberg@puppet.com, github:hlindberg, jira:henrik.lindberg
data/Rakefile CHANGED
@@ -83,8 +83,8 @@ task(:commits) do
83
83
  # populated with the range of commits the PR contains. If not available, this
84
84
  # falls back to `master..HEAD` as a next best bet as `master` is unlikely to
85
85
  # ever be absent.
86
- commit_range = ENV['TRAVIS_COMMIT_RANGE'].nil? ? 'master..HEAD' : ENV['TRAVIS_COMMIT_RANGE'].sub(/\.\.\./, '..')
87
- puts "Checking commits #{commit_range}"
86
+ commit_range = ENV['TRAVIS_COMMIT_RANGE'].nil? ? 'master..HEAD' : ENV['TRAVIS_COMMIT_RANGE']
87
+ puts "Checking commits..."
88
88
  %x{git log --no-merges --pretty=%s #{commit_range}}.each_line do |commit_summary|
89
89
  # This regex tests for the currently supported commit summary tokens: maint, doc, packaging, or pup-<number>.
90
90
  # The exception tries to explain it in more full.
@@ -39,7 +39,7 @@ class Puppet::Agent
39
39
  block_run = Puppet::Application.controlled_run do
40
40
  splay client_options.fetch :splay, Puppet[:splay]
41
41
  result = run_in_fork(should_fork) do
42
- with_client do |client|
42
+ with_client(client_options[:transaction_uuid]) do |client|
43
43
  begin
44
44
  client_args = client_options.merge(:pluginsync => Puppet::Configurer.should_pluginsync?)
45
45
  lock { client.run(client_args) }
@@ -88,9 +88,9 @@ class Puppet::Agent
88
88
 
89
89
  # Create and yield a client instance, keeping a reference
90
90
  # to it during the yield.
91
- def with_client
91
+ def with_client(transaction_uuid)
92
92
  begin
93
- @client = client_class.new
93
+ @client = client_class.new(Puppet::Configurer::DownloaderFactory.new, transaction_uuid)
94
94
  rescue StandardError => detail
95
95
  Puppet.log_exception(detail, "Could not create instance of #{client_class}: #{detail}")
96
96
  return
@@ -328,7 +328,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
328
328
  set_log_level
329
329
 
330
330
  if Puppet[:profile]
331
- @profiler = Puppet::Util::Profiler.add_profiler(Puppet::Util::Profiler::Aggregate.new(Puppet.method(:debug), "apply"))
331
+ @profiler = Puppet::Util::Profiler.add_profiler(Puppet::Util::Profiler::Aggregate.new(Puppet.method(:info), "apply"))
332
332
  end
333
333
  end
334
334
 
@@ -56,12 +56,12 @@ class Puppet::Configurer
56
56
  end
57
57
  end
58
58
 
59
- def initialize(factory = Puppet::Configurer::DownloaderFactory.new)
59
+ def initialize(factory = Puppet::Configurer::DownloaderFactory.new, transaction_uuid = nil)
60
60
  @running = false
61
61
  @splayed = false
62
62
  @cached_catalog_status = 'not_used'
63
63
  @environment = Puppet[:environment]
64
- @transaction_uuid = SecureRandom.uuid
64
+ @transaction_uuid = transaction_uuid || SecureRandom.uuid
65
65
  @static_catalog = true
66
66
  @checksum_type = Puppet[:supported_checksum_types]
67
67
  @handler = Puppet::Configurer::PluginHandler.new(factory)
@@ -1,3 +1,4 @@
1
+ # @api private
1
2
  module Puppet::DataProviders
2
3
 
3
4
  def self.assert_loaded
@@ -1,5 +1,6 @@
1
1
  # A DataAdapter adapts an object with a Hash of data
2
2
  #
3
+ # @api private
3
4
  class Puppet::DataProviders::DataAdapter < Puppet::Pops::Adaptable::Adapter
4
5
  include Puppet::Plugins::DataProviders
5
6
 
@@ -1,3 +1,4 @@
1
+ # @api private
1
2
  module Puppet::DataProviders::DataFunctionSupport
2
3
  def initialize_data(data_key, lookup_invocation)
3
4
  name = "#{data_key}::data"
@@ -8,6 +8,7 @@ module Puppet::DataProviders; end
8
8
  # The function is called on demand, and is associated with the compiler via an Adapter. This ensures that the data
9
9
  # is only produced once per compilation.
10
10
  #
11
+ # @api private
11
12
  class Puppet::DataProviders::FunctionEnvDataProvider < Puppet::Plugins::DataProviders::EnvironmentDataProvider
12
13
  include Puppet::DataProviders::DataFunctionSupport
13
14
 
@@ -8,6 +8,7 @@ module Puppet::DataProviders; end
8
8
  # The function is called on demand, and is associated with the compiler via an Adapter. This ensures that the data
9
9
  # is only produced once per compilation.
10
10
  #
11
+ # @api private
11
12
  class Puppet::DataProviders::FunctionModuleDataProvider < Puppet::Plugins::DataProviders::ModuleDataProvider
12
13
  include Puppet::DataProviders::DataFunctionSupport
13
14
 
@@ -2,6 +2,7 @@ require 'pathname'
2
2
  require 'puppet/pops/lookup/interpolation'
3
3
 
4
4
  module Puppet::DataProviders
5
+ # @api private
5
6
  class HieraConfig
6
7
  include Puppet::Plugins::DataProviders
7
8
  include Puppet::Pops::Lookup::Interpolation
@@ -2,6 +2,7 @@
2
2
  require_relative 'hiera_support'
3
3
 
4
4
  module Puppet::DataProviders
5
+ # @api private
5
6
  class HieraEnvDataProvider < Puppet::Plugins::DataProviders::EnvironmentDataProvider
6
7
  include HieraSupport
7
8
 
@@ -3,6 +3,7 @@ module Puppet::DataProviders::HieraInterpolate
3
3
  include Puppet::Pops::Lookup::Interpolation
4
4
 
5
5
  # For backward compatibility
6
+ # @api private
6
7
  # @deprecated
7
8
  def qualified_lookup(segments, value)
8
9
  if Puppet[:strict] != :off
@@ -2,6 +2,7 @@
2
2
  require_relative 'hiera_support'
3
3
 
4
4
  module Puppet::DataProviders
5
+ # @api private
5
6
  class HieraModuleDataProvider < Puppet::Plugins::DataProviders::ModuleDataProvider
6
7
  include HieraSupport
7
8
 
@@ -1,5 +1,6 @@
1
1
  require_relative 'hiera_config'
2
2
 
3
+ # @api private
3
4
  module Puppet::DataProviders::HieraSupport
4
5
  def config_path
5
6
  @hiera_config.nil? ? 'not yet configured' : @hiera_config.config_path
@@ -15,8 +16,6 @@ module Puppet::DataProviders::HieraSupport
15
16
  # @param key [String] The key to lookup
16
17
  # @param lookup_invocation [Puppet::Pops::Lookup::Invocation] The current lookup invocation
17
18
  # @param merge [Puppet::Pops::MergeStrategy,String,Hash<String,Object>,nil] Merge strategy or hash with strategy and options
18
- #
19
- # @api public
20
19
  def unchecked_lookup(key, lookup_invocation, merge)
21
20
  lookup_invocation.with(:data_provider, self) do
22
21
  merge_strategy = Puppet::Pops::MergeStrategy.strategy(merge)
@@ -3,6 +3,7 @@
3
3
  require 'json'
4
4
 
5
5
  module Puppet::DataProviders
6
+ # @api private
6
7
  class JsonDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
7
8
  def create(name, paths, parent_data_provider)
8
9
  JsonDataProvider.new(name, paths, parent_data_provider)
@@ -13,6 +14,7 @@ module Puppet::DataProviders
13
14
  end
14
15
  end
15
16
 
17
+ # @api private
16
18
  class JsonDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
17
19
  def initialize_data(path, lookup_invocation)
18
20
  JSON.parse(Puppet::FileSystem.read(path, :encoding => 'utf-8'))
@@ -3,6 +3,7 @@
3
3
  require 'yaml'
4
4
 
5
5
  module Puppet::DataProviders
6
+ # @api private
6
7
  class YamlDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
7
8
  def create(name, paths, parent_data_provider)
8
9
  YamlDataProvider.new(name, paths, parent_data_provider)
@@ -13,6 +14,7 @@ module Puppet::DataProviders
13
14
  end
14
15
  end
15
16
 
17
+ # @api private
16
18
  class YamlDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
17
19
  def initialize_data(path, lookup_invocation)
18
20
  data = YAML.load_file(path)
@@ -616,7 +616,7 @@ deprecated and has been replaced by 'always_retry_plugins'."
616
616
 
617
617
  Puppet.define_settings(:module_tool,
618
618
  :module_repository => {
619
- :default => 'https://forgeapi.puppetlabs.com',
619
+ :default => 'https://forgeapi.puppet.com',
620
620
  :desc => "The module repository",
621
621
  },
622
622
  :module_working_dir => {
@@ -1926,4 +1926,23 @@ EOT
1926
1926
  generate manifest documentation.",
1927
1927
  }
1928
1928
  )
1929
+
1930
+ define_settings(
1931
+ :main,
1932
+ :rich_data => {
1933
+ :default => false,
1934
+ :type => :boolean,
1935
+ :hook => proc do |value|
1936
+ envs = Puppet.lookup(:environments) { nil }
1937
+ envs.clear_all unless envs.nil?
1938
+ end,
1939
+ :desc => <<-'EOT'
1940
+ Enables having extended data in the catalog by adding the key `ext_parameters` to serialized
1941
+ resources. When enabled, resource containing values of the data types `Binary`, `Regexp`,
1942
+ `SemVer`, `SemVerRange`, `Timespan` and `Timestamp`, as well as instances of types derived
1943
+ from `Object` retain their data type and are serialized using Pcore in `ext_parameters`.
1944
+ EOT
1945
+ }
1946
+ )
1947
+
1929
1948
  end
@@ -41,7 +41,10 @@ module Puppet::Environments
41
41
 
42
42
  def clear_all
43
43
  root = Puppet.lookup(:root_environment) { nil }
44
- root.instance_variable_set(:@static_catalogs, nil) unless root.nil?
44
+ unless root.nil?
45
+ root.instance_variable_set(:@static_catalogs, nil)
46
+ root.instance_variable_set(:@rich_data, nil)
47
+ end
45
48
  end
46
49
  end
47
50
 
@@ -112,7 +115,7 @@ module Puppet::Environments
112
115
  def get_conf(name)
113
116
  env = get(name)
114
117
  if env
115
- Puppet::Settings::EnvironmentConf.static_for(env, 0, Puppet[:static_catalogs])
118
+ Puppet::Settings::EnvironmentConf.static_for(env, 0, Puppet[:static_catalogs], Puppet[:rich_data])
116
119
  else
117
120
  nil
118
121
  end
@@ -123,7 +123,7 @@ Puppet::Indirector::Face.define(:catalog, '0.0.1') do
123
123
 
124
124
  Puppet::Resource::Catalog.indirection.terminus_class = :yaml
125
125
  Puppet::Face[:catalog, "0.0.1"].save(catalog)
126
- Puppet.notice "Saved catalog for #{Puppet[:certname]} to yaml"
126
+ Puppet.notice "Saved catalog for #{Puppet[:certname]} to #{Puppet::Resource::Catalog.indirection.terminus.path(Puppet[:certname])}"
127
127
  nil
128
128
  end
129
129
  end
@@ -62,6 +62,8 @@ Puppet::Face.define(:epp, '0.0.1') do
62
62
  EOT
63
63
  when_invoked do |*args|
64
64
  options = args.pop
65
+ # pass a dummy node, as facts are not needed for validation
66
+ options[:node] = node = Puppet::Node.new("testnode", :facts => Puppet::Node::Facts.new("facts", {}))
65
67
  compiler = create_compiler(options)
66
68
 
67
69
  status = true # no validation error yet
@@ -141,6 +143,8 @@ Puppet::Face.define(:epp, '0.0.1') do
141
143
  when_invoked do |*args|
142
144
  require 'puppet/pops'
143
145
  options = args.pop
146
+ # pass a dummy node, as facts are not needed for dump
147
+ options[:node] = node = Puppet::Node.new("testnode", :facts => Puppet::Node::Facts.new("facts", {}))
144
148
  options[:header] = options[:header].nil? ? true : options[:header]
145
149
  options[:validate] = options[:validate].nil? ? true : options[:validate]
146
150
 
@@ -224,8 +228,12 @@ Puppet::Face.define(:epp, '0.0.1') do
224
228
  showing the name of the template before the output. The header output can be turned off with
225
229
  `--no-header`. This also concatenates the template results without any added newline separators.
226
230
 
227
- Facts for the simulated node can be feed to the rendering process by referencing a .yaml file
228
- with facts using the --facts option. (Values can be obtained in yaml format directly from
231
+ Facts from the node where the command is being run are used by default.args Facts can be obtained
232
+ for other nodes if they have called in, and reported their facts by using the `--node <nodename>`
233
+ flag.
234
+
235
+ Overriding node facts as well as additional facts can be given in a .yaml or .json file and referencing
236
+ it with the --facts option. (Values can be obtained in yaml format directly from
229
237
  `facter`, or from puppet for a given node). Note that it is not possible to simulate the
230
238
  reserved variable name `$facts` in any other way.
231
239
 
@@ -278,6 +286,10 @@ Puppet::Face.define(:epp, '0.0.1') do
278
286
  $ puppet epp render -e '<% $facts[osfamily] %>' --facts data.yaml
279
287
  EOT
280
288
 
289
+ option("--node <node_name>") do
290
+ summary "The name of the node for which facts are obtained. Defaults to facts for the local node."
291
+ end
292
+
281
293
  option "--e <source>" do
282
294
  default_to { nil }
283
295
  summary "Render one inline epp template given on the command line."
@@ -291,8 +303,8 @@ Puppet::Face.define(:epp, '0.0.1') do
291
303
  summary "A .pp or .yaml file that is processed to produce a hash of values for the template."
292
304
  end
293
305
 
294
- option("--facts <yaml_file>") do
295
- summary "A .yaml file containing a hash of facts made available in $facts"
306
+ option("--facts <facts_file>") do
307
+ summary "A .yaml or .json file containing a hash of facts made available in $facts and $trusted"
296
308
  end
297
309
 
298
310
  option("--[no-]header") do
@@ -444,16 +456,50 @@ Puppet::Face.define(:epp, '0.0.1') do
444
456
 
445
457
  # @api private
446
458
  def create_compiler(options)
447
- fact_values = options[:facts] ? YAML.load_file(options[:facts]) : {}
448
- node = Puppet::Node.new("testnode", :facts => Puppet::Node::Facts.new("facts", fact_values))
459
+ if options[:node]
460
+ node = options[:node]
461
+ else
462
+ node = Puppet[:node_name_value]
463
+
464
+ # If we want to lookup the node we are currently on
465
+ # we must returning these settings to their default values
466
+ Puppet.settings[:facts_terminus] = 'facter'
467
+ Puppet.settings[:node_cache_terminus] = nil
468
+ end
469
+
470
+ unless node.is_a?(Puppet::Node)
471
+ node = Puppet::Node.indirection.find(node)
472
+ # Found node must be given the environment to use in some cases, use the one configured
473
+ # or given on the command line
474
+ node.environment = Puppet[:environment]
475
+ end
476
+
477
+ fact_file = options[:facts]
478
+
479
+ if fact_file
480
+ if fact_file.is_a?(Hash) # when used via the Face API
481
+ given_facts = fact_file
482
+ elsif fact_file.end_with?("json")
483
+ given_facts = JSON.parse(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
484
+ else
485
+ given_facts = YAML.load(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
486
+ end
487
+
488
+ unless given_facts.instance_of?(Hash)
489
+ raise "Incorrect formatted data in #{fact_file} given via the --facts flag"
490
+ end
491
+ # It is difficult to add to or modify the set of facts once the node is created
492
+ # as changes does not show up in parameters. Rather than manually patching up
493
+ # a node and risking future regressions, a new node is created from scratch
494
+ node = Puppet::Node.new(node.name, :facts => Puppet::Node::Facts.new("facts", node.facts.values.merge(given_facts)))
495
+ node.environment = Puppet[:environment]
496
+ node.merge(node.facts.values)
497
+ end
498
+
449
499
  compiler = Puppet::Parser::Compiler.new(node)
450
500
  # configure compiler with facts and node related data
451
501
  # Set all global variables from facts
452
- fact_values.each {|param, value| compiler.topscope[param] = value }
453
- # Configured trusted data (even if there are none)
454
- compiler.topscope.set_trusted(node.trusted_data)
455
- # Set the facts hash
456
- compiler.topscope.set_facts(fact_values)
502
+ compiler.send(:set_node_parameters)
457
503
 
458
504
  # pretend that the main class (named '') has been evaluated
459
505
  # since it is otherwise not possible to resolve top scope variables