bolt 0.17.1 → 0.17.2

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 (224) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +25 -13
  3. data/lib/bolt/cli.rb +45 -15
  4. data/lib/bolt/config.rb +48 -132
  5. data/lib/bolt/executor.rb +3 -10
  6. data/lib/bolt/inventory.rb +15 -1
  7. data/lib/bolt/puppetdb.rb +11 -0
  8. data/lib/bolt/puppetdb/client.rb +68 -0
  9. data/lib/bolt/puppetdb/config.rb +76 -0
  10. data/lib/bolt/target.rb +5 -4
  11. data/lib/bolt/transport/base.rb +11 -2
  12. data/lib/bolt/transport/local.rb +11 -5
  13. data/lib/bolt/transport/orch.rb +16 -5
  14. data/lib/bolt/transport/ssh.rb +32 -1
  15. data/lib/bolt/transport/ssh/connection.rb +17 -10
  16. data/lib/bolt/transport/winrm.rb +18 -1
  17. data/lib/bolt/transport/winrm/connection.rb +15 -16
  18. data/lib/bolt/util.rb +15 -0
  19. data/lib/bolt/version.rb +1 -1
  20. data/lib/bolt_ext/puppetdb_inventory.rb +5 -135
  21. data/vendored/facter/lib/facter/ec2/rest.rb +1 -1
  22. data/vendored/hiera/lib/hiera/version.rb +1 -1
  23. data/vendored/puppet/lib/puppet/application/agent.rb +1 -3
  24. data/vendored/puppet/lib/puppet/application/apply.rb +2 -4
  25. data/vendored/puppet/lib/puppet/application/cert.rb +6 -1
  26. data/vendored/puppet/lib/puppet/application/device.rb +100 -13
  27. data/vendored/puppet/lib/puppet/application/facts.rb +5 -0
  28. data/vendored/puppet/lib/puppet/application/lookup.rb +11 -1
  29. data/vendored/puppet/lib/puppet/configurer.rb +17 -4
  30. data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +1 -1
  31. data/vendored/puppet/lib/puppet/datatypes.rb +1 -1
  32. data/vendored/puppet/lib/puppet/defaults.rb +1 -1
  33. data/vendored/puppet/lib/puppet/environments.rb +2 -2
  34. data/vendored/puppet/lib/puppet/error.rb +6 -3
  35. data/vendored/puppet/lib/puppet/external/dot.rb +0 -7
  36. data/vendored/puppet/lib/puppet/external/nagios/parser.rb +1 -1
  37. data/vendored/puppet/lib/puppet/face/config.rb +41 -8
  38. data/vendored/puppet/lib/puppet/face/epp.rb +30 -5
  39. data/vendored/puppet/lib/puppet/face/facts.rb +49 -0
  40. data/vendored/puppet/lib/puppet/face/help.rb +33 -35
  41. data/vendored/puppet/lib/puppet/face/man.rb +55 -12
  42. data/vendored/puppet/lib/puppet/face/parser.rb +30 -3
  43. data/vendored/puppet/lib/puppet/file_bucket/file.rb +0 -2
  44. data/vendored/puppet/lib/puppet/file_serving/base.rb +10 -10
  45. data/vendored/puppet/lib/puppet/functions.rb +1 -3
  46. data/vendored/puppet/lib/puppet/functions/alert.rb +1 -1
  47. data/vendored/puppet/lib/puppet/functions/all.rb +6 -6
  48. data/vendored/puppet/lib/puppet/functions/annotate.rb +10 -10
  49. data/vendored/puppet/lib/puppet/functions/any.rb +6 -6
  50. data/vendored/puppet/lib/puppet/functions/assert_type.rb +4 -4
  51. data/vendored/puppet/lib/puppet/functions/binary_file.rb +14 -2
  52. data/vendored/puppet/lib/puppet/functions/break.rb +31 -2
  53. data/vendored/puppet/lib/puppet/functions/call.rb +4 -4
  54. data/vendored/puppet/lib/puppet/functions/contain.rb +19 -3
  55. data/vendored/puppet/lib/puppet/functions/convert_to.rb +6 -5
  56. data/vendored/puppet/lib/puppet/functions/crit.rb +1 -1
  57. data/vendored/puppet/lib/puppet/functions/debug.rb +1 -1
  58. data/vendored/puppet/lib/puppet/functions/defined.rb +11 -9
  59. data/vendored/puppet/lib/puppet/functions/dig.rb +26 -2
  60. data/vendored/puppet/lib/puppet/functions/each.rb +8 -8
  61. data/vendored/puppet/lib/puppet/functions/emerg.rb +1 -1
  62. data/vendored/puppet/lib/puppet/functions/empty.rb +79 -0
  63. data/vendored/puppet/lib/puppet/functions/err.rb +1 -1
  64. data/vendored/puppet/lib/puppet/functions/filter.rb +7 -7
  65. data/vendored/puppet/lib/puppet/functions/find_file.rb +15 -1
  66. data/vendored/puppet/lib/puppet/functions/flatten.rb +64 -0
  67. data/vendored/puppet/lib/puppet/functions/hiera.rb +6 -6
  68. data/vendored/puppet/lib/puppet/functions/hiera_array.rb +6 -6
  69. data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
  70. data/vendored/puppet/lib/puppet/functions/hiera_include.rb +8 -8
  71. data/vendored/puppet/lib/puppet/functions/include.rb +28 -2
  72. data/vendored/puppet/lib/puppet/functions/info.rb +1 -1
  73. data/vendored/puppet/lib/puppet/functions/inline_epp.rb +2 -2
  74. data/vendored/puppet/lib/puppet/functions/join.rb +56 -0
  75. data/vendored/puppet/lib/puppet/functions/keys.rb +25 -0
  76. data/vendored/puppet/lib/puppet/functions/length.rb +44 -0
  77. data/vendored/puppet/lib/puppet/functions/lest.rb +39 -1
  78. data/vendored/puppet/lib/puppet/functions/map.rb +10 -9
  79. data/vendored/puppet/lib/puppet/functions/match.rb +6 -6
  80. data/vendored/puppet/lib/puppet/functions/new.rb +995 -2
  81. data/vendored/puppet/lib/puppet/functions/next.rb +1 -1
  82. data/vendored/puppet/lib/puppet/functions/notice.rb +1 -1
  83. data/vendored/puppet/lib/puppet/functions/reduce.rb +6 -6
  84. data/vendored/puppet/lib/puppet/functions/regsubst.rb +9 -3
  85. data/vendored/puppet/lib/puppet/functions/require.rb +36 -2
  86. data/vendored/puppet/lib/puppet/functions/return.rb +1 -1
  87. data/vendored/puppet/lib/puppet/functions/reverse_each.rb +71 -2
  88. data/vendored/puppet/lib/puppet/functions/slice.rb +23 -9
  89. data/vendored/puppet/lib/puppet/functions/split.rb +12 -10
  90. data/vendored/puppet/lib/puppet/functions/step.rb +73 -1
  91. data/vendored/puppet/lib/puppet/functions/strftime.rb +176 -2
  92. data/vendored/puppet/lib/puppet/functions/then.rb +65 -2
  93. data/vendored/puppet/lib/puppet/functions/tree_each.rb +19 -19
  94. data/vendored/puppet/lib/puppet/functions/type.rb +42 -1
  95. data/vendored/puppet/lib/puppet/functions/unique.rb +13 -13
  96. data/vendored/puppet/lib/puppet/functions/unwrap.rb +8 -4
  97. data/vendored/puppet/lib/puppet/functions/values.rb +25 -0
  98. data/vendored/puppet/lib/puppet/functions/versioncmp.rb +1 -1
  99. data/vendored/puppet/lib/puppet/functions/warning.rb +1 -1
  100. data/vendored/puppet/lib/puppet/functions/with.rb +6 -4
  101. data/vendored/puppet/lib/puppet/indirector/certificate_status/file.rb +1 -1
  102. data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +1 -3
  103. data/vendored/puppet/lib/puppet/indirector/facts/rest.rb +21 -0
  104. data/vendored/puppet/lib/puppet/indirector/facts/yaml.rb +0 -4
  105. data/vendored/puppet/lib/puppet/indirector/file_content/http.rb +3 -1
  106. data/vendored/puppet/lib/puppet/indirector/indirection.rb +5 -3
  107. data/vendored/puppet/lib/puppet/indirector/request.rb +6 -2
  108. data/vendored/puppet/lib/puppet/module/task.rb +2 -2
  109. data/vendored/puppet/lib/puppet/module_tool/tar/mini.rb +57 -4
  110. data/vendored/puppet/lib/puppet/network/authconfig.rb +1 -1
  111. data/vendored/puppet/lib/puppet/network/http/api/indirected_routes.rb +1 -0
  112. data/vendored/puppet/lib/puppet/network/resolver.rb +1 -2
  113. data/vendored/puppet/lib/puppet/node.rb +4 -3
  114. data/vendored/puppet/lib/puppet/parser/compiler.rb +12 -5
  115. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +1 -1
  116. data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +15 -4
  117. data/vendored/puppet/lib/puppet/parser/functions/new.rb +31 -46
  118. data/vendored/puppet/lib/puppet/parser/parser_factory.rb +1 -1
  119. data/vendored/puppet/lib/puppet/parser/resource.rb +1 -1
  120. data/vendored/puppet/lib/puppet/parser/type_loader.rb +11 -11
  121. data/vendored/puppet/lib/puppet/pops/evaluator/closure.rb +1 -1
  122. data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +1 -1
  123. data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +2 -2
  124. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -2
  125. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +5 -2
  126. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +1 -1
  127. data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +18 -1
  128. data/vendored/puppet/lib/puppet/pops/issues.rb +6 -3
  129. data/vendored/puppet/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +1 -2
  130. data/vendored/puppet/lib/puppet/pops/loader/ruby_function_instantiator.rb +1 -2
  131. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +4 -4
  132. data/vendored/puppet/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -1
  133. data/vendored/puppet/lib/puppet/pops/loaders.rb +18 -7
  134. data/vendored/puppet/lib/puppet/pops/lookup/global_data_provider.rb +1 -1
  135. data/vendored/puppet/lib/puppet/pops/model/factory.rb +6 -3
  136. data/vendored/puppet/lib/puppet/pops/model/model_tree_dumper.rb +4 -0
  137. data/vendored/puppet/lib/puppet/pops/model/pn_transformer.rb +400 -0
  138. data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +1 -1
  139. data/vendored/puppet/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  140. data/vendored/puppet/lib/puppet/pops/parser/lexer_support.rb +3 -2
  141. data/vendored/puppet/lib/puppet/pops/parser/locator.rb +0 -2
  142. data/vendored/puppet/lib/puppet/pops/parser/pn_parser.rb +316 -0
  143. data/vendored/puppet/lib/puppet/pops/pcore.rb +17 -17
  144. data/vendored/puppet/lib/puppet/pops/pn.rb +236 -0
  145. data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  146. data/vendored/puppet/lib/puppet/pops/types/class_loader.rb +6 -3
  147. data/vendored/puppet/lib/puppet/pops/types/implementation_registry.rb +28 -35
  148. data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +3 -3
  149. data/vendored/puppet/lib/puppet/pops/types/p_timespan_type.rb +2 -2
  150. data/vendored/puppet/lib/puppet/pops/types/p_type_set_type.rb +24 -1
  151. data/vendored/puppet/lib/puppet/pops/types/ruby_generator.rb +3 -4
  152. data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +1 -1
  153. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +0 -4
  154. data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
  155. data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +14 -7
  156. data/vendored/puppet/lib/puppet/pops/types/types.rb +1 -1
  157. data/vendored/puppet/lib/puppet/pops/utils.rb +2 -2
  158. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +6 -2
  159. data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +3 -1
  160. data/vendored/puppet/lib/puppet/provider/group/windows_adsi.rb +4 -7
  161. data/vendored/puppet/lib/puppet/provider/nameservice.rb +3 -3
  162. data/vendored/puppet/lib/puppet/provider/package/dnf.rb +1 -1
  163. data/vendored/puppet/lib/puppet/provider/package/gem.rb +1 -1
  164. data/vendored/puppet/lib/puppet/provider/package/pacman.rb +4 -4
  165. data/vendored/puppet/lib/puppet/provider/package/pip.rb +3 -3
  166. data/vendored/puppet/lib/puppet/provider/package/pkgdmg.rb +3 -3
  167. data/vendored/puppet/lib/puppet/provider/package/pkgutil.rb +2 -2
  168. data/vendored/puppet/lib/puppet/provider/package/portage.rb +9 -9
  169. data/vendored/puppet/lib/puppet/provider/package/zypper.rb +2 -2
  170. data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
  171. data/vendored/puppet/lib/puppet/provider/service/smf.rb +3 -2
  172. data/vendored/puppet/lib/puppet/provider/user/useradd.rb +6 -2
  173. data/vendored/puppet/lib/puppet/provider/user/windows_adsi.rb +1 -1
  174. data/vendored/puppet/lib/puppet/provider/zfs/zfs.rb +3 -2
  175. data/vendored/puppet/lib/puppet/reference/configuration.rb +2 -0
  176. data/vendored/puppet/lib/puppet/reference/type.rb +11 -11
  177. data/vendored/puppet/lib/puppet/resource.rb +1 -1
  178. data/vendored/puppet/lib/puppet/resource/capability_finder.rb +2 -2
  179. data/vendored/puppet/lib/puppet/resource/catalog.rb +2 -2
  180. data/vendored/puppet/lib/puppet/resource/status.rb +9 -2
  181. data/vendored/puppet/lib/puppet/resource/type.rb +1 -1
  182. data/vendored/puppet/lib/puppet/settings.rb +31 -19
  183. data/vendored/puppet/lib/puppet/settings/base_setting.rb +5 -0
  184. data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
  185. data/vendored/puppet/lib/puppet/settings/ttl_setting.rb +5 -0
  186. data/vendored/puppet/lib/puppet/ssl/certificate_factory.rb +2 -2
  187. data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +0 -2
  188. data/vendored/puppet/lib/puppet/transaction/additional_resource_generator.rb +2 -2
  189. data/vendored/puppet/lib/puppet/transaction/event.rb +1 -1
  190. data/vendored/puppet/lib/puppet/transaction/report.rb +1 -1
  191. data/vendored/puppet/lib/puppet/type.rb +9 -13
  192. data/vendored/puppet/lib/puppet/type/augeas.rb +2 -2
  193. data/vendored/puppet/lib/puppet/type/cron.rb +11 -6
  194. data/vendored/puppet/lib/puppet/type/exec.rb +1 -1
  195. data/vendored/puppet/lib/puppet/type/file.rb +4 -5
  196. data/vendored/puppet/lib/puppet/type/host.rb +1 -1
  197. data/vendored/puppet/lib/puppet/type/k5login.rb +30 -54
  198. data/vendored/puppet/lib/puppet/type/package.rb +3 -3
  199. data/vendored/puppet/lib/puppet/type/schedule.rb +12 -12
  200. data/vendored/puppet/lib/puppet/type/scheduled_task.rb +2 -2
  201. data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +5 -5
  202. data/vendored/puppet/lib/puppet/type/sshkey.rb +2 -2
  203. data/vendored/puppet/lib/puppet/type/tidy.rb +9 -2
  204. data/vendored/puppet/lib/puppet/type/user.rb +1 -1
  205. data/vendored/puppet/lib/puppet/type/yumrepo.rb +25 -4
  206. data/vendored/puppet/lib/puppet/type/zfs.rb +4 -0
  207. data/vendored/puppet/lib/puppet/util.rb +0 -4
  208. data/vendored/puppet/lib/puppet/util/backups.rb +1 -1
  209. data/vendored/puppet/lib/puppet/util/http_proxy.rb +4 -2
  210. data/vendored/puppet/lib/puppet/util/inifile.rb +3 -4
  211. data/vendored/puppet/lib/puppet/util/log.rb +2 -5
  212. data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +1 -1
  213. data/vendored/puppet/lib/puppet/util/reference.rb +1 -8
  214. data/vendored/puppet/lib/puppet/util/tagging.rb +1 -1
  215. data/vendored/puppet/lib/puppet/util/warnings.rb +0 -2
  216. data/vendored/puppet/lib/puppet/util/windows/adsi.rb +15 -18
  217. data/vendored/puppet/lib/puppet/util/windows/com.rb +2 -1
  218. data/vendored/puppet/lib/puppet/util/windows/file.rb +2 -2
  219. data/vendored/puppet/lib/puppet/util/windows/principal.rb +7 -6
  220. data/vendored/puppet/lib/puppet/util/windows/sid.rb +60 -7
  221. data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -9
  222. data/vendored/puppet/lib/puppet/version.rb +1 -1
  223. data/vendored/puppet/lib/puppet_pal.rb +53 -48
  224. metadata +15 -2
@@ -258,7 +258,7 @@ class Puppet::Resource::Type
258
258
  end
259
259
 
260
260
  if ['Class', 'Node'].include? resource.type
261
- scope.catalog.tag(*resource.tags)
261
+ scope.catalog.merge_tags_from(resource)
262
262
  end
263
263
  end
264
264
 
@@ -1296,31 +1296,43 @@ Generated on #{Time.now}.
1296
1296
  # @api public
1297
1297
  def interpolate(name)
1298
1298
  setting = @defaults[name]
1299
+ return nil unless setting
1299
1300
 
1300
- if setting
1301
- val = lookup(name)
1302
- # if we interpolate code, all hell breaks loose.
1303
- if name == :code
1304
- val
1305
- else
1306
- # Convert it if necessary
1307
- begin
1308
- val = convert(val, name)
1309
- rescue InterpolationError => err
1310
- # This happens because we don't have access to the param name when the
1311
- # exception is originally raised, but we want it in the message
1312
- raise InterpolationError, _("Error converting value for param '%{name}': %{detail}") % { name: name, detail: err }, err.backtrace
1313
- end
1301
+ lookup_and_convert(name) do |val|
1302
+ setting.munge(val)
1303
+ end
1304
+ end
1314
1305
 
1315
- setting.munge(val)
1316
- end
1317
- else
1318
- nil
1306
+ def print(name)
1307
+ setting = @defaults[name]
1308
+ return nil unless setting
1309
+
1310
+ lookup_and_convert(name) do |val|
1311
+ setting.print(val)
1319
1312
  end
1320
1313
  end
1321
1314
 
1322
1315
  private
1323
1316
 
1317
+ def lookup_and_convert(name, &block)
1318
+ val = lookup(name)
1319
+ # if we interpolate code, all hell breaks loose.
1320
+ if name == :code
1321
+ val
1322
+ else
1323
+ # Convert it if necessary
1324
+ begin
1325
+ val = convert(val, name)
1326
+ rescue InterpolationError => err
1327
+ # This happens because we don't have access to the param name when the
1328
+ # exception is originally raised, but we want it in the message
1329
+ raise InterpolationError, _("Error converting value for param '%{name}': %{detail}") % { name: name, detail: err }, err.backtrace
1330
+ end
1331
+
1332
+ yield val
1333
+ end
1334
+ end
1335
+
1324
1336
  def convert(value, setting_name)
1325
1337
  case value
1326
1338
  when nil
@@ -1397,7 +1409,7 @@ Generated on #{Time.now}.
1397
1409
  @values[name] = old_value
1398
1410
  raise e
1399
1411
  end
1400
- end
1412
+ end
1401
1413
 
1402
1414
  def inspect
1403
1415
  %Q{<#{self.class}:#{self.object_id} @name="#{@name}" @values="#{@values}">}
@@ -157,6 +157,11 @@ class Puppet::Settings::BaseSetting
157
157
  value
158
158
  end
159
159
 
160
+ # Print the value for the user in a config compatible format
161
+ def print(value)
162
+ munge(value)
163
+ end
164
+
160
165
  def set_meta(meta)
161
166
  Puppet.notice("#{name} does not support meta data. Ignoring.")
162
167
  end
@@ -131,7 +131,7 @@ private
131
131
  value = string.sub(/\{\s*([^}]+)\s*\}/) do
132
132
  params = $1
133
133
  params.split(/\s*,\s*/).each do |str|
134
- if str =~ /^\s*(\w+)\s*=\s*([\w\d]+)\s*$/
134
+ if str =~ /^\s*(\w+)\s*=\s*([\w]+)\s*$/
135
135
  param, value = $1.intern, $2
136
136
  result[param] = value
137
137
  unless [:owner, :mode, :group].include?(param)
@@ -25,6 +25,11 @@ class Puppet::Settings::TTLSetting < Puppet::Settings::BaseSetting
25
25
  self.class.munge(value, @name)
26
26
  end
27
27
 
28
+ def print(value)
29
+ val = munge(value)
30
+ val == Float::INFINITY ? 'unlimited' : val
31
+ end
32
+
28
33
  # Convert the value to Numeric, parsing numeric string with units if necessary.
29
34
  def self.munge(value, param_name)
30
35
  case
@@ -54,8 +54,6 @@ module Puppet::SSL::CertificateFactory
54
54
  return cert
55
55
  end
56
56
 
57
- private
58
-
59
57
  # Add X509v3 extensions to the given certificate.
60
58
  #
61
59
  # @param cert [OpenSSL::X509::Certificate] The certificate to add the
@@ -114,6 +112,7 @@ module Puppet::SSL::CertificateFactory
114
112
  generate_extension(ef, oid, *val)
115
113
  end
116
114
  end
115
+ private_class_method :add_extensions_to
117
116
 
118
117
  # Woot! We're a CA.
119
118
  def self.build_ca_extensions
@@ -216,4 +215,5 @@ module Puppet::SSL::CertificateFactory
216
215
  OpenSSL::X509::Extension.new(oid, OpenSSL::ASN1::UTF8String.new(val).to_der, crit)
217
216
  end
218
217
  end
218
+ private_class_method :generate_extension
219
219
  end
@@ -238,8 +238,6 @@ DOC
238
238
  end
239
239
  end
240
240
 
241
- private
242
-
243
241
  PRIVATE_EXTENSIONS = [
244
242
  'subjectAltName', '2.5.29.17',
245
243
  ]
@@ -86,7 +86,7 @@ class Puppet::Transaction::AdditionalResourceGenerator
86
86
  # tags such as the type name to support implicit filtering as well as
87
87
  # explicit. Note that resource#tags returns a duplicate of the resource's
88
88
  # tags.
89
- sentinel.tag(*resource.tags)
89
+ sentinel.merge_tags_from(resource)
90
90
  priority = @prioritizer.generate_priority_contained_in(resource, sentinel)
91
91
  @relationship_graph.add_vertex(sentinel, priority)
92
92
 
@@ -131,7 +131,7 @@ class Puppet::Transaction::AdditionalResourceGenerator
131
131
 
132
132
  def add_resource(res, parent_resource, priority=nil)
133
133
  if @catalog.resource(res.ref).nil?
134
- res.tag(*parent_resource.tags)
134
+ res.merge_tags_from(parent_resource)
135
135
  if parent_resource.depthfirst?
136
136
  @catalog.add_resource_before(parent_resource, res)
137
137
  else
@@ -12,7 +12,7 @@ class Puppet::Transaction::Event
12
12
  include Puppet::Network::FormatSupport
13
13
 
14
14
  ATTRIBUTES = [:name, :resource, :property, :previous_value, :desired_value, :historical_value, :status, :message, :file, :line, :source_description, :audited, :invalidate_refreshes, :redacted, :corrective_change]
15
- attr_accessor *ATTRIBUTES
15
+ attr_accessor(*ATTRIBUTES)
16
16
  attr_accessor :time
17
17
  attr_reader :default_log_level
18
18
 
@@ -218,7 +218,7 @@ class Puppet::Transaction::Report
218
218
  @external_times ||= {}
219
219
  @host = Puppet[:node_name_value]
220
220
  @time = Time.now
221
- @report_format = 8
221
+ @report_format = 9
222
222
  @puppet_version = Puppet.version
223
223
  @configuration_version = configuration_version
224
224
  @transaction_uuid = transaction_uuid
@@ -391,7 +391,7 @@ class Type
391
391
  @key_attributes_cache ||= key_attribute_parameters.collect { |p| p.name }
392
392
  end
393
393
 
394
- # Returns a mapping from the title string to setting of attribute value(s).
394
+ # Returns a mapping from the title string to setting of attribute values.
395
395
  # This default implementation provides a mapping of title to the one and only _namevar_ present
396
396
  # in the type's definition.
397
397
  # @note Advanced: some logic requires this mapping to be done differently, using a different
@@ -1474,7 +1474,7 @@ class Type
1474
1474
  @subclasses << sub
1475
1475
  end
1476
1476
 
1477
- # @return [Array<Puppet::Resource>] turns attribute value(s) into list of resources
1477
+ # @return [Array<Puppet::Resource>] turns attribute values into list of resources
1478
1478
  def munge(references)
1479
1479
  references = [references] unless references.is_a?(Array)
1480
1480
  references.collect do |ref|
@@ -1582,7 +1582,7 @@ class Type
1582
1582
  Multiple resources can be specified as an array of references. When this
1583
1583
  attribute is present:
1584
1584
 
1585
- * The required resource(s) will be applied **before** this resource.
1585
+ * The required resources will be applied **before** this resource.
1586
1586
 
1587
1587
  This is one of the four relationship metaparameters, along with
1588
1588
  `before`, `notify`, and `subscribe`. For more context, including the
@@ -1596,7 +1596,7 @@ class Type
1596
1596
  Multiple resources can be specified as an array of references. When this
1597
1597
  attribute is present:
1598
1598
 
1599
- * The subscribed resource(s) will be applied _before_ this resource.
1599
+ * The subscribed resources will be applied _before_ this resource.
1600
1600
  * If Puppet makes changes to any of the subscribed resources, it will cause
1601
1601
  this resource to _refresh._ (Refresh behavior varies by resource
1602
1602
  type: services will restart, mounts will unmount and re-mount, etc. Not
@@ -1614,7 +1614,7 @@ class Type
1614
1614
  Multiple resources can be specified as an array of references. When this
1615
1615
  attribute is present:
1616
1616
 
1617
- * This resource will be applied _before_ the dependent resource(s).
1617
+ * This resource will be applied _before_ the dependent resources.
1618
1618
 
1619
1619
  This is one of the four relationship metaparameters, along with
1620
1620
  `require`, `notify`, and `subscribe`. For more context, including the
@@ -1628,7 +1628,7 @@ class Type
1628
1628
  Multiple resources can be specified as an array of references. When this
1629
1629
  attribute is present:
1630
1630
 
1631
- * This resource will be applied _before_ the notified resource(s).
1631
+ * This resource will be applied _before_ the notified resources.
1632
1632
  * If Puppet makes changes to this resource, it will cause all of the
1633
1633
  notified resources to _refresh._ (Refresh behavior varies by resource
1634
1634
  type: services will restart, mounts will unmount and re-mount, etc. Not
@@ -1700,7 +1700,7 @@ The value of this parameter must be a reference to a capability resource,
1700
1700
  or an array of such references. Each capability resource referenced here
1701
1701
  must have been exported by another resource in the same environment.
1702
1702
 
1703
- The referenced capability resource(s) will be looked up, added to the
1703
+ The referenced capability resources will be looked up, added to the
1704
1704
  current node catalog, and processed following the underlying consumes
1705
1705
  clause.
1706
1706
 
@@ -2232,8 +2232,6 @@ end
2232
2232
 
2233
2233
  # class methods dealing with Type management
2234
2234
 
2235
- public
2236
-
2237
2235
  # The Type class attribute accessors
2238
2236
  class << self
2239
2237
  # @return [String] the name of the resource type; e.g., "File"
@@ -2343,8 +2341,6 @@ end
2343
2341
  # instance methods related to instance intrinsics
2344
2342
  # e.g., initialize and name
2345
2343
 
2346
- public
2347
-
2348
2344
  # @return [Hash] hash of parameters originally defined
2349
2345
  # @api private
2350
2346
  attr_reader :original_parameters
@@ -2388,7 +2384,7 @@ end
2388
2384
  end
2389
2385
  end
2390
2386
 
2391
- @tags = resource.tags
2387
+ merge_tags_from(resource)
2392
2388
 
2393
2389
  @original_parameters = resource.to_hash
2394
2390
 
@@ -2632,7 +2628,7 @@ end
2632
2628
  #
2633
2629
  def to_resource
2634
2630
  resource = self.retrieve_resource
2635
- resource.tag(*self.tags)
2631
+ resource.merge_tags_from(self)
2636
2632
 
2637
2633
  @parameters.each do |name, param|
2638
2634
  # Avoid adding each instance name twice
@@ -150,13 +150,13 @@ Puppet::Type.newtype(:augeas) do
150
150
  end
151
151
 
152
152
  newparam(:lens) do
153
- desc "Use a specific lens, e.g. `Hosts.lns`. When this parameter is set, you
153
+ desc "Use a specific lens, such as `Hosts.lns`. When this parameter is set, you
154
154
  must also set the `incl` parameter to indicate which file to load.
155
155
  The Augeas documentation includes [a list of available lenses](http://augeas.net/stock_lenses.html)."
156
156
  end
157
157
 
158
158
  newparam(:incl) do
159
- desc "Load only a specific file, e.g. `/etc/hosts`. This can greatly speed
159
+ desc "Load only a specific file, such as `/etc/hosts`. This can greatly speed
160
160
  up the execution the resource. When this parameter is set, you must also
161
161
  set the `lens` parameter to indicate which lens to use."
162
162
  end
@@ -278,9 +278,11 @@ Puppet::Type.newtype(:cron) do
278
278
  %w{sunday monday tuesday wednesday thursday friday saturday}
279
279
  end
280
280
  self.boundaries = [0, 7]
281
- desc "The weekday on which to run the command.
282
- Optional; if specified, must be between 0 and 7, inclusive, with
283
- 0 (or 7) being Sunday, or must be the name of the day (e.g., Tuesday)."
281
+ desc "The weekday on which to run the command. Optional; if specified,
282
+ must be either:
283
+
284
+ - A number between 0 and 7, inclusive, with 0 or 7 being Sunday
285
+ - The name of the day, such as 'Tuesday'."
284
286
  end
285
287
 
286
288
  newproperty(:month, :parent => CronParam) do
@@ -293,8 +295,11 @@ Puppet::Type.newtype(:cron) do
293
295
  august september october november december}
294
296
  end
295
297
  self.boundaries = [1, 12]
296
- desc "The month of the year. Optional; if specified
297
- must be between 1 and 12 or the month name (e.g., December)."
298
+ desc "The month of the year. Optional; if specified,
299
+ must be either:
300
+
301
+ - A number between 1 and 12, inclusive, with 1 being January
302
+ - The name of the month, such as 'December'."
298
303
  end
299
304
 
300
305
  newproperty(:monthday, :parent => CronParam) do
@@ -317,7 +322,7 @@ Puppet::Type.newtype(:cron) do
317
322
  but will not associate them with a specific job.
318
323
 
319
324
  Settings should be specified exactly as they should appear in
320
- the crontab, e.g., `PATH=/bin:/usr/bin:/usr/sbin`."
325
+ the crontab, like `PATH=/bin:/usr/bin:/usr/sbin`."
321
326
 
322
327
  validate do |value|
323
328
  unless value =~ /^\s*(\w+)\s*=\s*(.*)\s*$/ or value == :absent or value == "absent"
@@ -257,7 +257,7 @@ module Puppet
257
257
 
258
258
  newparam(:environment) do
259
259
  desc "An array of any additional environment variables you want to set for a
260
- command. e.g.: `[ 'HOME=/root', 'MAIL=root@example.com']`
260
+ command, such as `[ 'HOME=/root', 'MAIL=root@example.com']`.
261
261
  Note that if you use this to set PATH, it will override the `path`
262
262
  attribute. Multiple environment variables should be specified as an
263
263
  array."
@@ -74,7 +74,7 @@ Puppet::Type.newtype(:file) do
74
74
  (`File { backup => main }`), so it can affect all file resources.
75
75
 
76
76
  * If set to `false`, file content won't be backed up.
77
- * If set to a string beginning with `.` (e.g., `.puppet-bak`), Puppet will
77
+ * If set to a string beginning with `.`, such as `.puppet-bak`, Puppet will
78
78
  use copy the file in the same directory with that value as the extension
79
79
  of the backup. (A value of `true` is a synonym for `.puppet-bak`.)
80
80
  * If set to any other string, Puppet will try to back up to a filebucket
@@ -187,8 +187,7 @@ Puppet::Type.newtype(:file) do
187
187
  Setting `recurselimit => 2` will manage the direct contents of the
188
188
  directory, as well as the contents of the _first_ level of subdirectories.
189
189
 
190
- And so on --- 3 will manage the contents of the second level of
191
- subdirectories, etc."
190
+ This pattern continues for each incremental value of `recurselimit`."
192
191
 
193
192
  newvalues(/^[0-9]+$/)
194
193
 
@@ -225,9 +224,9 @@ Puppet::Type.newtype(:file) do
225
224
  newparam(:ignore) do
226
225
  desc "A parameter which omits action on files matching
227
226
  specified patterns during recursion. Uses Ruby's builtin globbing
228
- engine, so shell metacharacters are fully supported, e.g. `[a-z]*`.
227
+ engine, so shell metacharacters such as `[a-z]*` are fully supported.
229
228
  Matches that would descend into the directory structure are ignored,
230
- e.g., `*/*`."
229
+ such as `*/*`."
231
230
 
232
231
  validate do |value|
233
232
  unless value.is_a?(Array) or value.is_a?(String) or value == false
@@ -80,7 +80,7 @@ module Puppet
80
80
 
81
81
  validate do |value|
82
82
  value.split('.').each do |hostpart|
83
- unless hostpart =~ /^([\d\w]+|[\d\w][\d\w\-]+[\d\w])$/
83
+ unless hostpart =~ /^([\w]+|[\w][\w\-]+[\w])$/
84
84
  raise Puppet::Error, _("Invalid host name")
85
85
  end
86
86
  end
@@ -1,6 +1,7 @@
1
1
  # Plug-in type for handling k5login files
2
2
  require 'puppet/util'
3
3
  require 'puppet/util/selinux'
4
+ require 'puppet/type/file/selcontext'
4
5
 
5
6
  Puppet::Type.newtype(:k5login) do
6
7
  @doc = "Manage the `.k5login` file for a user. Specify the full path to
@@ -33,7 +34,7 @@ Puppet::Type.newtype(:k5login) do
33
34
  end
34
35
 
35
36
  # To manage the selinux user of the file
36
- newproperty(:seluser) do
37
+ newproperty(:seluser, :parent => Puppet::SELFileContext) do
37
38
  desc "What the SELinux user component of the context of the file should be.
38
39
  Any valid SELinux user component is accepted. For example `user_u`.
39
40
  If not specified it defaults to the value returned by matchpathcon for
@@ -44,7 +45,7 @@ Puppet::Type.newtype(:k5login) do
44
45
  end
45
46
 
46
47
  # To manage the selinux role of the file
47
- newproperty(:selrole) do
48
+ newproperty(:selrole, :parent => Puppet::SELFileContext) do
48
49
  desc "What the SELinux role component of the context of the file should be.
49
50
  Any valid SELinux role component is accepted. For example `role_r`.
50
51
  If not specified it defaults to the value returned by matchpathcon for
@@ -55,7 +56,7 @@ Puppet::Type.newtype(:k5login) do
55
56
  end
56
57
 
57
58
  # To manage the selinux type of the file
58
- newproperty(:seltype) do
59
+ newproperty(:seltype, :parent => Puppet::SELFileContext) do
59
60
  desc "What the SELinux type component of the context of the file should be.
60
61
  Any valid SELinux type component is accepted. For example `tmp_t`.
61
62
  If not specified it defaults to the value returned by matchpathcon for
@@ -67,7 +68,7 @@ Puppet::Type.newtype(:k5login) do
67
68
  end
68
69
 
69
70
  # To manage the selinux range of the file
70
- newproperty(:selrange) do
71
+ newproperty(:selrange, :parent => Puppet::SELFileContext) do
71
72
  desc "What the SELinux range component of the context of the file should be.
72
73
  Any valid SELinux range component is accepted. For example `s0` or
73
74
  `SystemHigh`. If not specified it defaults to the value returned by
@@ -78,6 +79,31 @@ Puppet::Type.newtype(:k5login) do
78
79
  defaultto { "s0" }
79
80
  end
80
81
 
82
+ # Stat our file.
83
+ #
84
+ # We use the initial value :needs_stat to ensure we only stat the file once,
85
+ # but can also keep track of a failed stat (@stat == nil). This also allows
86
+ # us to re-stat on demand by setting @stat = :needs_stat.
87
+ def stat
88
+ return @stat unless @stat == :needs_stat
89
+
90
+ @stat = begin
91
+ Puppet::FileSystem.stat(self[:path])
92
+ rescue Errno::ENOENT
93
+ nil
94
+ rescue Errno::ENOTDIR
95
+ nil
96
+ rescue Errno::EACCES
97
+ warning _("Could not stat; permission denied")
98
+ nil
99
+ end
100
+ end
101
+
102
+ def initialize(args)
103
+ @stat = :needs_stat
104
+ super
105
+ end
106
+
81
107
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
82
108
 
83
109
  provide(:k5login) do
@@ -129,56 +155,6 @@ Puppet::Type.newtype(:k5login) do
129
155
  File.chmod(Integer("0#{value}"), @resource[:name])
130
156
  end
131
157
 
132
- # Set the file seluser
133
- def seluser
134
- if selinux_support?
135
- context = get_selinux_current_context(@resource[:name])
136
- return parse_selinux_context(:seluser, context)
137
- end
138
- end
139
-
140
- def seluser=(value)
141
- set_selinux_context(@resource[:name], value, :seluser)
142
- end
143
-
144
- # Set the file selrole
145
- def selrole
146
- if selinux_support?
147
- context = get_selinux_current_context(@resource[:name])
148
- return parse_selinux_context(:selrole, context)
149
- end
150
- end
151
-
152
- # Set the file seltype
153
- def selrole=(value)
154
- set_selinux_context(@resource[:name], value, :selrole)
155
- end
156
-
157
- # Set the file seltype
158
- def seltype
159
- if selinux_support?
160
- context = get_selinux_current_context(@resource[:name])
161
- return parse_selinux_context(:seltype, context)
162
- end
163
- end
164
-
165
- # Set the file selrange
166
- def seltype=(value)
167
- set_selinux_context(@resource[:name], value, :seltype)
168
- end
169
-
170
- # Set the file selrange
171
- def selrange
172
- if selinux_support?
173
- context = get_selinux_current_context(@resource[:name])
174
- return parse_selinux_context(:selrange, context)
175
- end
176
- end
177
-
178
- def selrange=(value)
179
- set_selinux_context(@resource[:name], value, :selrange)
180
- end
181
-
182
158
  private
183
159
  def write(value)
184
160
  Puppet::Util.replace_file(@resource[:name], 0644) do |f|