bolt 0.20.3 → 0.20.5

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

Potentially problematic release.


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

Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +3 -3
  3. data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +33 -0
  4. data/lib/bolt/inventory.rb +19 -1
  5. data/lib/bolt/target.rb +15 -0
  6. data/lib/bolt/transport/local.rb +6 -1
  7. data/lib/bolt/transport/orch.rb +2 -0
  8. data/lib/bolt/transport/ssh.rb +7 -2
  9. data/lib/bolt/transport/winrm.rb +6 -1
  10. data/lib/bolt/version.rb +1 -1
  11. data/modules/facts/plans/retrieve.pp +2 -26
  12. data/modules/facts/tasks/init.json +9 -0
  13. data/vendored/puppet/lib/hiera/puppet_function.rb +1 -1
  14. data/vendored/puppet/lib/hiera/scope.rb +24 -2
  15. data/vendored/puppet/lib/puppet.rb +4 -13
  16. data/vendored/puppet/lib/puppet/application.rb +2 -2
  17. data/vendored/puppet/lib/puppet/application/agent.rb +1 -1
  18. data/vendored/puppet/lib/puppet/application/apply.rb +1 -1
  19. data/vendored/puppet/lib/puppet/application/cert.rb +1 -1
  20. data/vendored/puppet/lib/puppet/application/device.rb +8 -8
  21. data/vendored/puppet/lib/puppet/application/face_base.rb +1 -1
  22. data/vendored/puppet/lib/puppet/application/lookup.rb +2 -2
  23. data/vendored/puppet/lib/puppet/application/resource.rb +2 -2
  24. data/vendored/puppet/lib/puppet/application/script.rb +1 -1
  25. data/vendored/puppet/lib/puppet/configurer.rb +47 -24
  26. data/vendored/puppet/lib/puppet/confine.rb +4 -1
  27. data/vendored/puppet/lib/puppet/context.rb +1 -1
  28. data/vendored/puppet/lib/puppet/defaults.rb +32 -44
  29. data/vendored/puppet/lib/puppet/error.rb +14 -7
  30. data/vendored/puppet/lib/puppet/external/dot.rb +23 -17
  31. data/vendored/puppet/lib/puppet/face/config.rb +58 -3
  32. data/vendored/puppet/lib/puppet/face/epp.rb +1 -1
  33. data/vendored/puppet/lib/puppet/face/module/build.rb +3 -3
  34. data/vendored/puppet/lib/puppet/face/module/install.rb +0 -4
  35. data/vendored/puppet/lib/puppet/face/module/list.rb +0 -5
  36. data/vendored/puppet/lib/puppet/face/module/search.rb +1 -1
  37. data/vendored/puppet/lib/puppet/face/module/uninstall.rb +0 -4
  38. data/vendored/puppet/lib/puppet/face/module/upgrade.rb +0 -4
  39. data/vendored/puppet/lib/puppet/face/status.rb +2 -2
  40. data/vendored/puppet/lib/puppet/file_serving/base.rb +5 -5
  41. data/vendored/puppet/lib/puppet/file_serving/metadata.rb +2 -1
  42. data/vendored/puppet/lib/puppet/forge.rb +7 -8
  43. data/vendored/puppet/lib/puppet/forge/errors.rb +3 -3
  44. data/vendored/puppet/lib/puppet/functions/abs.rb +61 -0
  45. data/vendored/puppet/lib/puppet/functions/all.rb +2 -2
  46. data/vendored/puppet/lib/puppet/functions/any.rb +2 -2
  47. data/vendored/puppet/lib/puppet/functions/assert_type.rb +3 -3
  48. data/vendored/puppet/lib/puppet/functions/break.rb +3 -7
  49. data/vendored/puppet/lib/puppet/functions/camelcase.rb +62 -0
  50. data/vendored/puppet/lib/puppet/functions/capitalize.rb +61 -0
  51. data/vendored/puppet/lib/puppet/functions/ceiling.rb +37 -0
  52. data/vendored/puppet/lib/puppet/functions/chomp.rb +57 -0
  53. data/vendored/puppet/lib/puppet/functions/chop.rb +67 -0
  54. data/vendored/puppet/lib/puppet/functions/compare.rb +125 -0
  55. data/vendored/puppet/lib/puppet/functions/convert_to.rb +3 -2
  56. data/vendored/puppet/lib/puppet/functions/dig.rb +21 -1
  57. data/vendored/puppet/lib/puppet/functions/downcase.rb +89 -0
  58. data/vendored/puppet/lib/puppet/functions/each.rb +2 -2
  59. data/vendored/puppet/lib/puppet/functions/empty.rb +1 -3
  60. data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
  61. data/vendored/puppet/lib/puppet/functions/filter.rb +2 -2
  62. data/vendored/puppet/lib/puppet/functions/floor.rb +37 -0
  63. data/vendored/puppet/lib/puppet/functions/get.rb +150 -0
  64. data/vendored/puppet/lib/puppet/functions/getvar.rb +87 -0
  65. data/vendored/puppet/lib/puppet/functions/hiera.rb +5 -5
  66. data/vendored/puppet/lib/puppet/functions/hiera_array.rb +5 -5
  67. data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
  68. data/vendored/puppet/lib/puppet/functions/hiera_include.rb +7 -7
  69. data/vendored/puppet/lib/puppet/functions/hocon_data.rb +1 -1
  70. data/vendored/puppet/lib/puppet/functions/json_data.rb +3 -3
  71. data/vendored/puppet/lib/puppet/functions/lest.rb +1 -1
  72. data/vendored/puppet/lib/puppet/functions/lookup.rb +3 -2
  73. data/vendored/puppet/lib/puppet/functions/lstrip.rb +58 -0
  74. data/vendored/puppet/lib/puppet/functions/map.rb +1 -1
  75. data/vendored/puppet/lib/puppet/functions/match.rb +11 -0
  76. data/vendored/puppet/lib/puppet/functions/max.rb +183 -0
  77. data/vendored/puppet/lib/puppet/functions/min.rb +182 -0
  78. data/vendored/puppet/lib/puppet/functions/next.rb +1 -8
  79. data/vendored/puppet/lib/puppet/functions/reduce.rb +1 -1
  80. data/vendored/puppet/lib/puppet/functions/return.rb +1 -8
  81. data/vendored/puppet/lib/puppet/functions/reverse_each.rb +1 -1
  82. data/vendored/puppet/lib/puppet/functions/round.rb +24 -0
  83. data/vendored/puppet/lib/puppet/functions/rstrip.rb +58 -0
  84. data/vendored/puppet/lib/puppet/functions/size.rb +15 -0
  85. data/vendored/puppet/lib/puppet/functions/sort.rb +74 -0
  86. data/vendored/puppet/lib/puppet/functions/step.rb +1 -1
  87. data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -7
  88. data/vendored/puppet/lib/puppet/functions/strip.rb +58 -0
  89. data/vendored/puppet/lib/puppet/functions/then.rb +1 -1
  90. data/vendored/puppet/lib/puppet/functions/tree_each.rb +7 -7
  91. data/vendored/puppet/lib/puppet/functions/upcase.rb +89 -0
  92. data/vendored/puppet/lib/puppet/functions/with.rb +4 -4
  93. data/vendored/puppet/lib/puppet/functions/yaml_data.rb +4 -2
  94. data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
  95. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/rest.rb +0 -11
  96. data/vendored/puppet/lib/puppet/indirector/indirection.rb +8 -12
  97. data/vendored/puppet/lib/puppet/indirector/node/exec.rb +1 -1
  98. data/vendored/puppet/lib/puppet/indirector/node/ldap.rb +1 -1
  99. data/vendored/puppet/lib/puppet/indirector/request.rb +11 -11
  100. data/vendored/puppet/lib/puppet/indirector/rest.rb +11 -11
  101. data/vendored/puppet/lib/puppet/interface/action.rb +2 -5
  102. data/vendored/puppet/lib/puppet/metatype/manager.rb +0 -2
  103. data/vendored/puppet/lib/puppet/module.rb +7 -33
  104. data/vendored/puppet/lib/puppet/module/task.rb +0 -1
  105. data/vendored/puppet/lib/puppet/module_tool.rb +2 -5
  106. data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +5 -5
  107. data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +2 -2
  108. data/vendored/puppet/lib/puppet/module_tool/applications/checksummer.rb +3 -3
  109. data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +6 -7
  110. data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +1 -2
  111. data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +2 -2
  112. data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +5 -6
  113. data/vendored/puppet/lib/puppet/module_tool/dependency.rb +1 -1
  114. data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +2 -2
  115. data/vendored/puppet/lib/puppet/module_tool/local_tarball.rb +3 -3
  116. data/vendored/puppet/lib/puppet/module_tool/metadata.rb +3 -4
  117. data/vendored/puppet/lib/puppet/module_tool/shared_behaviors.rb +2 -2
  118. data/vendored/puppet/lib/puppet/network/authconfig.rb +0 -13
  119. data/vendored/puppet/lib/puppet/network/format_support.rb +1 -1
  120. data/vendored/puppet/lib/puppet/network/formats.rb +5 -7
  121. data/vendored/puppet/lib/puppet/network/http.rb +0 -2
  122. data/vendored/puppet/lib/puppet/network/http/api.rb +1 -10
  123. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +2 -2
  124. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environments.rb +2 -2
  125. data/vendored/puppet/lib/puppet/network/http/compression.rb +1 -1
  126. data/vendored/puppet/lib/puppet/network/http/connection.rb +11 -3
  127. data/vendored/puppet/lib/puppet/network/http/error.rb +3 -3
  128. data/vendored/puppet/lib/puppet/network/http/factory.rb +3 -0
  129. data/vendored/puppet/lib/puppet/network/http/handler.rb +59 -27
  130. data/vendored/puppet/lib/puppet/network/resolver.rb +140 -67
  131. data/vendored/puppet/lib/puppet/node/environment.rb +2 -19
  132. data/vendored/puppet/lib/puppet/parameter.rb +12 -7
  133. data/vendored/puppet/lib/puppet/parser/ast.rb +4 -8
  134. data/vendored/puppet/lib/puppet/parser/ast/branch.rb +3 -3
  135. data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +5 -0
  136. data/vendored/puppet/lib/puppet/parser/ast/pops_bridge.rb +18 -0
  137. data/vendored/puppet/lib/puppet/parser/compiler.rb +3 -4
  138. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +9 -2
  139. data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
  140. data/vendored/puppet/lib/puppet/parser/functions/assert_type.rb +3 -3
  141. data/vendored/puppet/lib/puppet/parser/functions/create_resources.rb +1 -7
  142. data/vendored/puppet/lib/puppet/parser/functions/each.rb +2 -2
  143. data/vendored/puppet/lib/puppet/parser/functions/filter.rb +1 -1
  144. data/vendored/puppet/lib/puppet/parser/functions/hiera.rb +4 -4
  145. data/vendored/puppet/lib/puppet/parser/functions/hiera_array.rb +5 -5
  146. data/vendored/puppet/lib/puppet/parser/functions/hiera_hash.rb +6 -6
  147. data/vendored/puppet/lib/puppet/parser/functions/hiera_include.rb +10 -11
  148. data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -1
  149. data/vendored/puppet/lib/puppet/parser/functions/lest.rb +1 -1
  150. data/vendored/puppet/lib/puppet/parser/functions/lookup.rb +1 -1
  151. data/vendored/puppet/lib/puppet/parser/functions/map.rb +1 -1
  152. data/vendored/puppet/lib/puppet/parser/functions/reduce.rb +1 -1
  153. data/vendored/puppet/lib/puppet/parser/functions/return.rb +22 -1
  154. data/vendored/puppet/lib/puppet/parser/functions/reverse_each.rb +1 -1
  155. data/vendored/puppet/lib/puppet/parser/functions/step.rb +1 -1
  156. data/vendored/puppet/lib/puppet/parser/functions/then.rb +1 -1
  157. data/vendored/puppet/lib/puppet/parser/functions/with.rb +4 -4
  158. data/vendored/puppet/lib/puppet/parser/resource.rb +0 -1
  159. data/vendored/puppet/lib/puppet/parser/resource/param.rb +12 -5
  160. data/vendored/puppet/lib/puppet/parser/scope.rb +5 -7
  161. data/vendored/puppet/lib/puppet/pops/evaluator/compare_operator.rb +3 -1
  162. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +2 -7
  163. data/vendored/puppet/lib/puppet/pops/issues.rb +4 -0
  164. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
  165. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +17 -12
  166. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +73 -45
  167. data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +55 -6
  168. data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +2 -0
  169. data/vendored/puppet/lib/puppet/pops/parser/epp_parser.rb +1 -1
  170. data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +6 -2
  171. data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +1 -1
  172. data/vendored/puppet/lib/puppet/pops/pcore.rb +7 -7
  173. data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +15 -1
  174. data/vendored/puppet/lib/puppet/pops/serialization.rb +2 -2
  175. data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +2 -2
  176. data/vendored/puppet/lib/puppet/pops/serialization/json.rb +7 -7
  177. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +5 -5
  178. data/vendored/puppet/lib/puppet/pops/types/types.rb +8 -4
  179. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +73 -0
  180. data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +4 -3
  181. data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +7 -0
  182. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -1
  183. data/vendored/puppet/lib/puppet/provider/user/aix.rb +2 -2
  184. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +21 -9
  185. data/vendored/puppet/lib/puppet/reference/providers.rb +1 -1
  186. data/vendored/puppet/lib/puppet/reference/report.rb +1 -1
  187. data/vendored/puppet/lib/puppet/resource.rb +1 -1
  188. data/vendored/puppet/lib/puppet/resource/capability_finder.rb +4 -4
  189. data/vendored/puppet/lib/puppet/resource/catalog.rb +6 -3
  190. data/vendored/puppet/lib/puppet/resource/type.rb +6 -2
  191. data/vendored/puppet/lib/puppet/rest/client.rb +79 -0
  192. data/vendored/puppet/lib/puppet/rest/errors.rb +14 -0
  193. data/vendored/puppet/lib/puppet/rest/response.rb +29 -0
  194. data/vendored/puppet/lib/puppet/rest/route.rb +102 -0
  195. data/vendored/puppet/lib/puppet/rest/routes.rb +31 -0
  196. data/vendored/puppet/lib/puppet/settings.rb +9 -5
  197. data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
  198. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +10 -1
  199. data/vendored/puppet/lib/puppet/ssl.rb +0 -1
  200. data/vendored/puppet/lib/puppet/ssl/certificate.rb +6 -2
  201. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +3 -3
  202. data/vendored/puppet/lib/puppet/ssl/host.rb +258 -19
  203. data/vendored/puppet/lib/puppet/ssl/validator/default_validator.rb +33 -19
  204. data/vendored/puppet/lib/puppet/syntax_checkers/json.rb +1 -1
  205. data/vendored/puppet/lib/puppet/transaction/event.rb +34 -7
  206. data/vendored/puppet/lib/puppet/transaction/report.rb +17 -14
  207. data/vendored/puppet/lib/puppet/type.rb +20 -12
  208. data/vendored/puppet/lib/puppet/type/file.rb +1 -1
  209. data/vendored/puppet/lib/puppet/type/file/content.rb +15 -2
  210. data/vendored/puppet/lib/puppet/type/file/ensure.rb +1 -1
  211. data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
  212. data/vendored/puppet/lib/puppet/type/stage.rb +1 -1
  213. data/vendored/puppet/lib/puppet/type/tidy.rb +5 -1
  214. data/vendored/puppet/lib/puppet/type/user.rb +35 -18
  215. data/vendored/puppet/lib/puppet/type/yumrepo.rb +8 -17
  216. data/vendored/puppet/lib/puppet/util.rb +0 -1
  217. data/vendored/puppet/lib/puppet/util/autoload.rb +1 -6
  218. data/vendored/puppet/lib/puppet/util/checksums.rb +0 -2
  219. data/vendored/puppet/lib/puppet/util/classgen.rb +0 -6
  220. data/vendored/puppet/lib/puppet/util/fileparsing.rb +27 -5
  221. data/vendored/puppet/lib/puppet/util/instance_loader.rb +3 -3
  222. data/vendored/puppet/lib/puppet/util/json.rb +77 -0
  223. data/vendored/puppet/lib/puppet/util/json_lockfile.rb +3 -3
  224. data/vendored/puppet/lib/puppet/util/ldap/connection.rb +7 -7
  225. data/vendored/puppet/lib/puppet/util/log/destinations.rb +2 -2
  226. data/vendored/puppet/lib/puppet/util/logging.rb +1 -1
  227. data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
  228. data/vendored/puppet/lib/puppet/util/provider_features.rb +2 -5
  229. data/vendored/puppet/lib/puppet/util/reference.rb +5 -4
  230. data/vendored/puppet/lib/puppet/util/tagging.rb +16 -3
  231. data/vendored/puppet/lib/puppet/version.rb +1 -1
  232. metadata +44 -26
  233. data/vendored/puppet/lib/puppet/application/master.rb +0 -317
  234. data/vendored/puppet/lib/puppet/feature/rack.rb +0 -19
  235. data/vendored/puppet/lib/puppet/network/http/api/ca.rb +0 -2
  236. data/vendored/puppet/lib/puppet/network/http/api/ca/v1.rb +0 -11
  237. data/vendored/puppet/lib/puppet/network/http/rack.rb +0 -33
  238. data/vendored/puppet/lib/puppet/network/http/rack/rest.rb +0 -162
  239. data/vendored/puppet/lib/puppet/network/http/webrick.rb +0 -124
  240. data/vendored/puppet/lib/puppet/network/http/webrick/rest.rb +0 -114
  241. data/vendored/puppet/lib/puppet/network/server.rb +0 -39
  242. data/vendored/puppet/lib/puppet/ssl/configuration.rb +0 -61
  243. data/vendored/puppet/lib/puppet/util/methodhelper.rb +0 -32
  244. data/vendored/puppet/lib/puppet/vendor/load_semantic.rb +0 -1
  245. data/vendored/puppet/lib/puppet/vendor/load_semantic_puppet.rb +0 -1
  246. data/vendored/puppet/lib/puppet/vendor/semantic/lib/semantic.rb +0 -5
  247. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +0 -11
  248. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency.rb +0 -181
  249. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph.rb +0 -60
  250. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph_node.rb +0 -117
  251. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/module_release.rb +0 -58
  252. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/source.rb +0 -25
  253. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/unsatisfiable_graph.rb +0 -31
  254. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +0 -3
  255. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +0 -203
  256. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +0 -758
@@ -20,7 +20,7 @@ class Puppet::SyntaxCheckers::Json < Puppet::Plugins::SyntaxCheckers::SyntaxChec
20
20
  #raise ArgumentError.new("Json syntax checker: location_info must be a Hash") unless location_info.is_a?(Hash)
21
21
 
22
22
  begin
23
- JSON.parse(text)
23
+ Puppet::Util::Json.load(text)
24
24
  rescue => e
25
25
  # Cap the message to 100 chars and replace newlines
26
26
  msg = _("JSON syntax checker: Cannot parse invalid JSON string. \"%{message}\"") % { message: e.message().slice(0,100).gsub(/\r?\n/, "\\n") }
@@ -1,12 +1,10 @@
1
1
  require 'puppet/transaction'
2
2
  require 'puppet/util/tagging'
3
3
  require 'puppet/util/logging'
4
- require 'puppet/util/methodhelper'
5
4
  require 'puppet/network/format_support'
6
5
 
7
6
  # A simple struct for storing what happens on the system.
8
7
  class Puppet::Transaction::Event
9
- include Puppet::Util::MethodHelper
10
8
  include Puppet::Util::Tagging
11
9
  include Puppet::Util::Logging
12
10
  include Puppet::Network::FormatSupport
@@ -24,12 +22,41 @@ class Puppet::Transaction::Event
24
22
  obj
25
23
  end
26
24
 
27
- def initialize(options = {})
28
- @audited = false
29
- @redacted = false
30
- @corrective_change = false
25
+ def initialize(audited: false,
26
+ corrective_change: false,
27
+ desired_value: nil,
28
+ file: nil,
29
+ historical_value: nil,
30
+ invalidate_refreshes: nil,
31
+ line: nil,
32
+ message: nil,
33
+ name: nil,
34
+ previous_value: nil,
35
+ property: nil,
36
+ redacted: false,
37
+ resource: nil,
38
+ source_description: nil,
39
+ status: nil,
40
+ tags: nil)
41
+
42
+ @audited = audited
43
+ @corrective_change = corrective_change
44
+ @desired_value = desired_value
45
+ @file = file
46
+ @historical_value = historical_value
47
+ @invalidate_refreshes = invalidate_refreshes
48
+ @line = line
49
+ @message = message
50
+ @name = name
51
+ @previous_value = previous_value
52
+ @redacted = redacted
53
+ @source_description = source_description
54
+ @tags = tags
55
+
56
+ self.property = property if property
57
+ self.resource = resource if resource
58
+ self.status = status if status
31
59
 
32
- set_options(options)
33
60
  @time = Time.now
34
61
  end
35
62
 
@@ -134,6 +134,8 @@ class Puppet::Transaction::Report
134
134
  #
135
135
  attr_accessor :transaction_completed
136
136
 
137
+ TOTAL = "total".freeze
138
+
137
139
  def self.from_data_hash(data)
138
140
  obj = self.allocate
139
141
  obj.initialize_from_hash(data)
@@ -151,8 +153,12 @@ class Puppet::Transaction::Report
151
153
  end
152
154
 
153
155
  # @api private
154
- def add_times(name, value)
155
- @external_times[name] = value
156
+ def add_times(name, value, accumulate = true)
157
+ if @external_times[name] && accumulate
158
+ @external_times[name] += value
159
+ else
160
+ @external_times[name] = value
161
+ end
156
162
  end
157
163
 
158
164
  # @api private
@@ -204,7 +210,7 @@ class Puppet::Transaction::Report
204
210
  resource_metrics = add_metric(:resources, calculate_resource_metrics)
205
211
  add_metric(:time, calculate_time_metrics)
206
212
  change_metric = calculate_change_metric
207
- add_metric(:changes, {"total" => change_metric})
213
+ add_metric(:changes, {TOTAL => change_metric})
208
214
  add_metric(:events, calculate_event_metrics)
209
215
  @status = compute_status(resource_metrics, change_metric)
210
216
  @noop_pending = @resource_statuses.any? { |name,res| has_noop_events?(res) }
@@ -345,9 +351,9 @@ class Puppet::Transaction::Report
345
351
 
346
352
  report[key].keys.sort { |a,b|
347
353
  # sort by label
348
- if a == :total
354
+ if a == TOTAL
349
355
  1
350
- elsif b == :total
356
+ elsif b == TOTAL
351
357
  -1
352
358
  else
353
359
  report[key][a].to_s <=> report[key][b].to_s
@@ -375,7 +381,7 @@ class Puppet::Transaction::Report
375
381
  metric.values.each do |metric_name, label, value|
376
382
  report[key][metric_name.to_s] = value
377
383
  end
378
- report[key]["total"] = 0 unless key == "time" or report[key].include?("total")
384
+ report[key][TOTAL] = 0 unless key == "time" or report[key].include?(TOTAL)
379
385
  end
380
386
  (report["time"] ||= {})["last_run"] = Time.now.tv_sec
381
387
  report
@@ -393,10 +399,10 @@ class Puppet::Transaction::Report
393
399
  #
394
400
  def exit_status
395
401
  status = 0
396
- if @metrics["changes"] && @metrics["changes"]["total"] &&
402
+ if @metrics["changes"] && @metrics["changes"][TOTAL] &&
397
403
  @metrics["resources"] && @metrics["resources"]["failed"] &&
398
404
  @metrics["resources"]["failed_to_restart"]
399
- status |= 2 if @metrics["changes"]["total"] > 0
405
+ status |= 2 if @metrics["changes"][TOTAL] > 0
400
406
  status |= 4 if @metrics["resources"]["failed"] > 0
401
407
  status |= 4 if @metrics["resources"]["failed_to_restart"] > 0
402
408
  else
@@ -422,7 +428,7 @@ class Puppet::Transaction::Report
422
428
  metrics = Hash.new(0)
423
429
  %w{total failure success}.each { |m| metrics[m] = 0 }
424
430
  resource_statuses.each do |name, status|
425
- metrics["total"] += status.events.length
431
+ metrics[TOTAL] += status.events.length
426
432
  status.events.each do |event|
427
433
  metrics[event.status] += 1
428
434
  end
@@ -433,7 +439,7 @@ class Puppet::Transaction::Report
433
439
 
434
440
  def calculate_resource_metrics
435
441
  metrics = {}
436
- metrics["total"] = resource_statuses.length
442
+ metrics[TOTAL] = resource_statuses.length
437
443
 
438
444
  # force every resource key in the report to be present
439
445
  # even if no resources is in this given state
@@ -453,16 +459,13 @@ class Puppet::Transaction::Report
453
459
  def calculate_time_metrics
454
460
  metrics = Hash.new(0)
455
461
  resource_statuses.each do |name, status|
456
- type = Puppet::Resource.new(name).type
457
- metrics[type.to_s.downcase] += status.evaluation_time if status.evaluation_time
462
+ metrics[status.resource_type.downcase] += status.evaluation_time if status.evaluation_time
458
463
  end
459
464
 
460
465
  @external_times.each do |name, value|
461
466
  metrics[name.to_s.downcase] = value
462
467
  end
463
468
 
464
- metrics["total"] = metrics.values.inject(0) { |a,b| a+b }
465
-
466
469
  metrics
467
470
  end
468
471
  end
@@ -826,6 +826,7 @@ class Type
826
826
  #
827
827
  def set_default(attr)
828
828
  return unless klass = self.class.attrclass(attr)
829
+ # TODO this is not a necessary check, as we define a class level attr_reader
829
830
  return unless klass.method_defined?(:default)
830
831
  return if @parameters.include?(klass.name)
831
832
 
@@ -1252,7 +1253,7 @@ class Type
1252
1253
  event _would_ have been sent.
1253
1254
 
1254
1255
  **Important note:**
1255
- [The `noop` setting](https://docs.puppetlabs.com/puppet/latest/reference/configuration.html#noop)
1256
+ [The `noop` setting](https://puppet.com/docs/puppet/latest/configuration.html#noop)
1256
1257
  allows you to globally enable or disable noop mode, but it will _not_ override
1257
1258
  the `noop` metaparameter on individual resources. That is, the value of the
1258
1259
  global `noop` setting will _only_ affect resources that do not have an explicit
@@ -1272,7 +1273,7 @@ class Type
1272
1273
  The value of this metaparameter must be the `name` of a `schedule`
1273
1274
  resource. This means you must declare a schedule resource, then
1274
1275
  refer to it by name; see
1275
- [the docs for the `schedule` type](https://docs.puppetlabs.com/puppet/latest/reference/type.html#schedule)
1276
+ [the docs for the `schedule` type](https://puppet.com/docs/puppet/latest/type.html#schedule)
1276
1277
  for more info.
1277
1278
 
1278
1279
  schedule { 'everyday':
@@ -1447,7 +1448,7 @@ class Type
1447
1448
  }
1448
1449
 
1449
1450
  Tags are useful for things like applying a subset of a host's configuration
1450
- with [the `tags` setting](/puppet/latest/reference/configuration.html#tags)
1451
+ with [the `tags` setting](/puppet/latest/configuration.html#tags)
1451
1452
  (e.g. `puppet agent --test --tags bootstrap`)."
1452
1453
 
1453
1454
  munge do |tags|
@@ -1578,7 +1579,7 @@ class Type
1578
1579
 
1579
1580
  newmetaparam(:require, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do
1580
1581
  desc "One or more resources that this resource depends on, expressed as
1581
- [resource references](https://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1582
+ [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1582
1583
  Multiple resources can be specified as an array of references. When this
1583
1584
  attribute is present:
1584
1585
 
@@ -1587,12 +1588,12 @@ class Type
1587
1588
  This is one of the four relationship metaparameters, along with
1588
1589
  `before`, `notify`, and `subscribe`. For more context, including the
1589
1590
  alternate chaining arrow (`->` and `~>`) syntax, see
1590
- [the language page on relationships](https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html)."
1591
+ [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1591
1592
  end
1592
1593
 
1593
1594
  newmetaparam(:subscribe, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :ALL_EVENTS, :callback => :refresh}) do
1594
1595
  desc "One or more resources that this resource depends on, expressed as
1595
- [resource references](https://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1596
+ [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1596
1597
  Multiple resources can be specified as an array of references. When this
1597
1598
  attribute is present:
1598
1599
 
@@ -1605,12 +1606,12 @@ class Type
1605
1606
  This is one of the four relationship metaparameters, along with
1606
1607
  `before`, `require`, and `notify`. For more context, including the
1607
1608
  alternate chaining arrow (`->` and `~>`) syntax, see
1608
- [the language page on relationships](https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html)."
1609
+ [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1609
1610
  end
1610
1611
 
1611
1612
  newmetaparam(:before, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do
1612
1613
  desc "One or more resources that depend on this resource, expressed as
1613
- [resource references](https://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1614
+ [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1614
1615
  Multiple resources can be specified as an array of references. When this
1615
1616
  attribute is present:
1616
1617
 
@@ -1619,12 +1620,12 @@ class Type
1619
1620
  This is one of the four relationship metaparameters, along with
1620
1621
  `require`, `notify`, and `subscribe`. For more context, including the
1621
1622
  alternate chaining arrow (`->` and `~>`) syntax, see
1622
- [the language page on relationships](https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html)."
1623
+ [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1623
1624
  end
1624
1625
 
1625
1626
  newmetaparam(:notify, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :ALL_EVENTS, :callback => :refresh}) do
1626
1627
  desc "One or more resources that depend on this resource, expressed as
1627
- [resource references](https://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1628
+ [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1628
1629
  Multiple resources can be specified as an array of references. When this
1629
1630
  attribute is present:
1630
1631
 
@@ -1637,7 +1638,7 @@ class Type
1637
1638
  This is one of the four relationship metaparameters, along with
1638
1639
  `before`, `require`, and `subscribe`. For more context, including the
1639
1640
  alternate chaining arrow (`->` and `~>`) syntax, see
1640
- [the language page on relationships](https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html)."
1641
+ [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1641
1642
  end
1642
1643
 
1643
1644
  newmetaparam(:stage) do
@@ -1650,7 +1651,7 @@ class Type
1650
1651
  By default, all classes are declared in the `main` stage. To assign a class
1651
1652
  to a different stage, you must:
1652
1653
 
1653
- * Declare the new stage as a [`stage` resource](https://docs.puppetlabs.com/puppet/latest/reference/type.html#stage).
1654
+ * Declare the new stage as a [`stage` resource](https://puppet.com/docs/puppet/latest/type.html#stage).
1654
1655
  * Declare an order relationship between the new stage and the `main` stage.
1655
1656
  * Use the resource-like syntax to declare the class, and set the `stage`
1656
1657
  metaparameter to the name of the desired stage.
@@ -2443,6 +2444,13 @@ end
2443
2444
  err(_("Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}.") % { name: name, type: type })
2444
2445
  end
2445
2446
  end
2447
+
2448
+ parameters.each do |name, param|
2449
+ next if param.sensitive
2450
+ if param.is_a?(Puppet::Parameter)
2451
+ param.sensitive = param.is_sensitive if param.respond_to?(:is_sensitive)
2452
+ end
2453
+ end
2446
2454
  end
2447
2455
 
2448
2456
  private
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require 'digest/md5'
2
3
  require 'cgi'
3
4
  require 'etc'
@@ -12,7 +13,6 @@ require 'puppet/util/backups'
12
13
  require 'puppet/util/symbolic_file_mode'
13
14
 
14
15
  Puppet::Type.newtype(:file) do
15
- include Puppet::Util::MethodHelper
16
16
  include Puppet::Util::Checksums
17
17
  include Puppet::Util::Backups
18
18
  include Puppet::Util::SymbolicFileMode
@@ -35,8 +35,8 @@ module Puppet
35
35
  }
36
36
 
37
37
  ...but for larger files, this attribute is more useful when combined with the
38
- [template](https://docs.puppetlabs.com/puppet/latest/reference/function.html#template)
39
- or [file](https://docs.puppetlabs.com/puppet/latest/reference/function.html#file)
38
+ [template](https://puppet.com/docs/puppet/latest/function.html#template)
39
+ or [file](https://puppet.com/docs/puppet/latest/function.html#file)
40
40
  function.
41
41
  EOT
42
42
 
@@ -48,6 +48,19 @@ module Puppet
48
48
  elsif value.is_a?(String) && checksum?(value)
49
49
  # XXX This is potentially dangerous because it means users can't write a file whose
50
50
  # entire contents are a plain checksum unless it is a Binary content.
51
+ Puppet.puppet_deprecation_warning([
52
+ #TRANSLATORS "content" is an attribute and should not be translated
53
+ _('Using a checksum in a file\'s "content" property is deprecated.'),
54
+ #TRANSLATORS "filebucket" is a resource type and should not be translated. The quoted occurrence of "content" is an attribute and should not be translated.
55
+ _('The ability to use a checksum to retrieve content from the filebucket using the "content" property will be removed in a future release.'),
56
+ #TRANSLATORS "content" is an attribute and should not be translated.
57
+ _('The literal value of the "content" property will be written to the file.'),
58
+ #TRANSLATORS "static catalogs" should not be translated.
59
+ _('The checksum retrieval functionality is being replaced by the use of static catalogs.'),
60
+ _('See https://puppet.com/docs/puppet/latest/static_catalogs.html for more information.')].join(" "),
61
+ :file => @resource.file,
62
+ :line => @resource.line
63
+ ) if !@actual_content && !resource.parameter(:source)
51
64
  value
52
65
  else
53
66
  @actual_content = value.is_a?(Puppet::Pops::Types::PBinaryType::Binary) ? value.binary_buffer : value
@@ -47,7 +47,7 @@ module Puppet
47
47
 
48
48
  However, we recommend using `link` and `target` explicitly, since this
49
49
  behavior can be harder to read and is
50
- [deprecated](https://docs.puppetlabs.com/puppet/4.3/reference/deprecated_language.html)
50
+ [deprecated](https://docs.puppet.com/puppet/4.3/deprecated_language.html)
51
51
  as of Puppet 4.3.0.
52
52
  EOT
53
53
 
@@ -2,7 +2,7 @@ module Puppet
2
2
  Type.newtype(:schedule) do
3
3
  @doc = <<-'EOT'
4
4
  Define schedules for Puppet. Resources can be limited to a schedule by using the
5
- [`schedule`](https://docs.puppetlabs.com/puppet/latest/reference/metaparameter.html#schedule)
5
+ [`schedule`](https://puppet.com/docs/puppet/latest/metaparameter.html#schedule)
6
6
  metaparameter.
7
7
 
8
8
  Currently, **schedules can only be used to stop a resource from being
@@ -2,7 +2,7 @@ Puppet::Type.newtype(:stage) do
2
2
  desc "A resource type for creating new run stages. Once a stage is available,
3
3
  classes can be assigned to it by declaring them with the resource-like syntax
4
4
  and using
5
- [the `stage` metaparameter](https://docs.puppetlabs.com/puppet/latest/reference/metaparameter.html#stage).
5
+ [the `stage` metaparameter](https://puppet.com/docs/puppet/latest/metaparameter.html#stage).
6
6
 
7
7
  Note that new stages are not useful unless you also declare their order
8
8
  in relation to the default `main` stage.
@@ -310,6 +310,10 @@ Puppet::Type.newtype(:tidy) do
310
310
 
311
311
  # Should we remove the specified file?
312
312
  def tidy?(path)
313
+ # ignore files that are already managed, since we can't tidy
314
+ # those files anyway
315
+ return false if catalog.resource(:file, path)
316
+
313
317
  return false unless stat = self.stat(path)
314
318
 
315
319
  return false if stat.ftype == "directory" and ! rmdirs?
@@ -334,7 +338,7 @@ Puppet::Type.newtype(:tidy) do
334
338
  begin
335
339
  Puppet::FileSystem.lstat(path)
336
340
  rescue Errno::ENOENT
337
- info _("File does not exist")
341
+ debug _("File does not exist")
338
342
  return nil
339
343
  rescue Errno::EACCES
340
344
  #TRANSLATORS "stat" is a program name and should not be translated
@@ -212,33 +212,50 @@ module Puppet
212
212
  * OS X 10.8 and higher use salted SHA512 PBKDF2 hashes. When managing passwords
213
213
  on these systems, the `salt` and `iterations` attributes need to be specified as
214
214
  well as the password.
215
- * Windows passwords can only be managed in cleartext, as there is no Windows API
216
- for setting the password hash.
215
+ * Windows passwords can be managed only in cleartext, because there is no Windows
216
+ API for setting the password hash.
217
217
 
218
218
  [stdlib]: https://github.com/puppetlabs/puppetlabs-stdlib/
219
219
 
220
220
  Enclose any value that includes a dollar sign ($) in single quotes (') to avoid
221
- accidental variable interpolation.}
221
+ accidental variable interpolation.
222
222
 
223
- validate do |value|
224
- raise ArgumentError, _("Passwords cannot include ':'") if value.is_a?(String) and value.include?(":")
225
- end
223
+ To redact passwords from reports to PuppetDB, use the `Sensitive` data type. For
224
+ example, this resource protects the password:
226
225
 
227
- def change_to_s(currentvalue, newvalue)
228
- if currentvalue == :absent
229
- return _("created password")
230
- else
231
- return _("changed password")
232
- end
233
- end
226
+ ```puppet
227
+ user { 'foo':
228
+ ensure => present,
229
+ password => Sensitive("my secret password")
230
+ }
231
+ ```
232
+
233
+ This results in the password being redacted from the report, as in the
234
+ `previous_value`, `desired_value`, and `message` fields below.
235
+
236
+ ```yaml
237
+ events:
238
+ - !ruby/object:Puppet::Transaction::Event
239
+ audited: false
240
+ property: password
241
+ previous_value: "[redacted]"
242
+ desired_value: "[redacted]"
243
+ historical_value:
244
+ message: changed [redacted] to [redacted]
245
+ name: :password_changed
246
+ status: success
247
+ time: 2017-05-17 16:06:02.934398293 -07:00
248
+ redacted: true
249
+ corrective_change: false
250
+ corrective_change: false
251
+ ```
252
+ }
234
253
 
235
- def is_to_s( currentvalue )
236
- return _('[old password hash redacted]')
237
- end
238
- def should_to_s( newvalue )
239
- return _('[new password hash redacted]')
254
+ validate do |value|
255
+ raise ArgumentError, _("Passwords cannot include ':'") if value.is_a?(String) and value.include?(":")
240
256
  end
241
257
 
258
+ sensitive true
242
259
  end
243
260
 
244
261
  newproperty(:password_min_age, :required_features => :manages_password_age) do