puppet 5.3.3-x64-mingw32 → 5.3.4-x64-mingw32

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

Potentially problematic release.


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

Files changed (291) hide show
  1. data/CONTRIBUTING.md +1 -1
  2. data/Gemfile +3 -0
  3. data/ext/puppet-test +3 -2
  4. data/lib/hiera/puppet_function.rb +5 -2
  5. data/lib/hiera_puppet.rb +3 -3
  6. data/lib/puppet.rb +2 -5
  7. data/lib/puppet/agent.rb +22 -2
  8. data/lib/puppet/agent/locker.rb +6 -5
  9. data/lib/puppet/application.rb +18 -1
  10. data/lib/puppet/application/agent.rb +9 -2
  11. data/lib/puppet/application/apply.rb +1 -1
  12. data/lib/puppet/application/config.rb +1 -0
  13. data/lib/puppet/application/device.rb +1 -2
  14. data/lib/puppet/application/filebucket.rb +22 -5
  15. data/lib/puppet/application/help.rb +1 -0
  16. data/lib/puppet/application/lookup.rb +1 -3
  17. data/lib/puppet/application_support.rb +6 -1
  18. data/lib/puppet/bindings.rb +2 -1
  19. data/lib/puppet/configurer.rb +9 -4
  20. data/lib/puppet/configurer/downloader_factory.rb +10 -0
  21. data/lib/puppet/configurer/plugin_handler.rb +11 -4
  22. data/lib/puppet/daemon.rb +2 -2
  23. data/lib/puppet/defaults.rb +99 -27
  24. data/lib/puppet/environments.rb +2 -0
  25. data/lib/puppet/error.rb +5 -15
  26. data/lib/puppet/external/pson/common.rb +2 -2
  27. data/lib/puppet/face/catalog.rb +1 -1
  28. data/lib/puppet/face/config.rb +14 -1
  29. data/lib/puppet/face/epp.rb +4 -2
  30. data/lib/puppet/face/help.rb +12 -14
  31. data/lib/puppet/face/man.rb +1 -0
  32. data/lib/puppet/face/module/build.rb +1 -1
  33. data/lib/puppet/face/module/list.rb +6 -17
  34. data/lib/puppet/face/module/uninstall.rb +14 -3
  35. data/lib/puppet/face/node.rb +1 -0
  36. data/lib/puppet/face/status.rb +1 -0
  37. data/lib/puppet/file_serving/base.rb +2 -1
  38. data/lib/puppet/file_serving/configuration.rb +3 -0
  39. data/lib/puppet/file_serving/configuration/parser.rb +23 -9
  40. data/lib/puppet/file_serving/mount/locales.rb +35 -0
  41. data/lib/puppet/forge.rb +2 -1
  42. data/lib/puppet/forge/errors.rb +24 -22
  43. data/lib/puppet/functions/binary_file.rb +1 -0
  44. data/lib/puppet/functions/each.rb +10 -4
  45. data/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
  46. data/lib/puppet/functions/lookup.rb +2 -2
  47. data/lib/puppet/functions/map.rb +12 -2
  48. data/lib/puppet/functions/slice.rb +2 -3
  49. data/lib/puppet/functions/unique.rb +1 -1
  50. data/lib/puppet/functions/yaml_data.rb +1 -1
  51. data/lib/puppet/gettext/config.rb +144 -41
  52. data/lib/puppet/gettext/module_translations.rb +42 -0
  53. data/lib/puppet/graph/relationship_graph.rb +1 -1
  54. data/lib/puppet/graph/simple_graph.rb +3 -3
  55. data/lib/puppet/indirector/catalog/compiler.rb +40 -25
  56. data/lib/puppet/indirector/exec.rb +1 -1
  57. data/lib/puppet/indirector/facts/facter.rb +3 -3
  58. data/lib/puppet/indirector/facts/network_device.rb +2 -2
  59. data/lib/puppet/indirector/file_bucket_file/file.rb +4 -1
  60. data/lib/puppet/indirector/indirection.rb +17 -9
  61. data/lib/puppet/indirector/ldap.rb +2 -2
  62. data/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
  63. data/lib/puppet/indirector/rest.rb +8 -5
  64. data/lib/puppet/indirector/ssl_file.rb +2 -2
  65. data/lib/puppet/indirector/terminus.rb +3 -3
  66. data/lib/puppet/interface.rb +2 -1
  67. data/lib/puppet/interface/action.rb +41 -24
  68. data/lib/puppet/interface/action_builder.rb +14 -5
  69. data/lib/puppet/interface/action_manager.rb +1 -1
  70. data/lib/puppet/interface/documentation.rb +21 -10
  71. data/lib/puppet/interface/face_collection.rb +4 -2
  72. data/lib/puppet/interface/option.rb +36 -15
  73. data/lib/puppet/interface/option_builder.rb +23 -9
  74. data/lib/puppet/interface/option_manager.rb +8 -3
  75. data/lib/puppet/metatype/manager.rb +7 -3
  76. data/lib/puppet/module.rb +18 -21
  77. data/lib/puppet/module_tool/errors/installer.rb +18 -20
  78. data/lib/puppet/module_tool/errors/shared.rb +20 -15
  79. data/lib/puppet/module_tool/errors/uninstaller.rb +1 -0
  80. data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
  81. data/lib/puppet/module_tool/tar/mini.rb +57 -4
  82. data/lib/puppet/network/auth_config_parser.rb +18 -13
  83. data/lib/puppet/network/authstore.rb +2 -2
  84. data/lib/puppet/network/client_request.rb +1 -1
  85. data/lib/puppet/network/format.rb +3 -3
  86. data/lib/puppet/network/http/api/indirection_type.rb +1 -1
  87. data/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
  88. data/lib/puppet/network/http/error.rb +7 -7
  89. data/lib/puppet/network/http/factory.rb +9 -0
  90. data/lib/puppet/network/http/rack.rb +2 -2
  91. data/lib/puppet/network/http/webrick.rb +2 -4
  92. data/lib/puppet/node.rb +25 -6
  93. data/lib/puppet/node/environment.rb +14 -0
  94. data/lib/puppet/node/facts.rb +9 -0
  95. data/lib/puppet/parameter.rb +3 -3
  96. data/lib/puppet/parameter/value_collection.rb +9 -9
  97. data/lib/puppet/parser/ast/leaf.rb +1 -1
  98. data/lib/puppet/parser/ast/node.rb +2 -2
  99. data/lib/puppet/parser/ast/pops_bridge.rb +1 -1
  100. data/lib/puppet/parser/compiler.rb +6 -5
  101. data/lib/puppet/parser/functions.rb +1 -1
  102. data/lib/puppet/parser/functions/generate.rb +2 -4
  103. data/lib/puppet/parser/functions/inline_template.rb +1 -2
  104. data/lib/puppet/parser/functions/sprintf.rb +17 -3
  105. data/lib/puppet/parser/functions/template.rb +6 -2
  106. data/lib/puppet/parser/resource.rb +30 -31
  107. data/lib/puppet/parser/scope.rb +20 -11
  108. data/lib/puppet/parser/templatewrapper.rb +4 -3
  109. data/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
  110. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
  111. data/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
  112. data/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
  113. data/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
  114. data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
  115. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
  116. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  117. data/lib/puppet/pops/functions/dispatch.rb +1 -1
  118. data/lib/puppet/pops/functions/function.rb +8 -2
  119. data/lib/puppet/pops/issue_reporter.rb +7 -2
  120. data/lib/puppet/pops/issues.rb +10 -4
  121. data/lib/puppet/pops/label_provider.rb +1 -1
  122. data/lib/puppet/pops/loader/module_loaders.rb +5 -2
  123. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  124. data/lib/puppet/pops/loaders.rb +7 -3
  125. data/lib/puppet/pops/lookup/explainer.rb +2 -1
  126. data/lib/puppet/pops/lookup/hiera_config.rb +2 -2
  127. data/lib/puppet/pops/lookup/lookup_adapter.rb +4 -4
  128. data/lib/puppet/pops/merge_strategy.rb +6 -3
  129. data/lib/puppet/pops/migration/migration_checker.rb +8 -8
  130. data/lib/puppet/pops/model/ast_transformer.rb +1 -1
  131. data/lib/puppet/pops/model/factory.rb +4 -2
  132. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  133. data/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
  134. data/lib/puppet/pops/types/iterable.rb +2 -0
  135. data/lib/puppet/pops/types/p_object_type.rb +36 -15
  136. data/lib/puppet/pops/types/type_calculator.rb +2 -1
  137. data/lib/puppet/pops/types/type_factory.rb +3 -1
  138. data/lib/puppet/pops/types/type_mismatch_describer.rb +19 -6
  139. data/lib/puppet/pops/types/type_parser.rb +7 -7
  140. data/lib/puppet/pops/types/types.rb +10 -4
  141. data/lib/puppet/pops/validation.rb +14 -12
  142. data/lib/puppet/property.rb +14 -6
  143. data/lib/puppet/property/ensure.rb +2 -2
  144. data/lib/puppet/provider.rb +4 -4
  145. data/lib/puppet/provider/group/aix.rb +4 -2
  146. data/lib/puppet/provider/ldap.rb +2 -2
  147. data/lib/puppet/provider/naginator.rb +1 -1
  148. data/lib/puppet/provider/nameservice.rb +7 -4
  149. data/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
  150. data/lib/puppet/provider/package/aix.rb +1 -1
  151. data/lib/puppet/provider/package/nim.rb +7 -8
  152. data/lib/puppet/provider/package/opkg.rb +1 -1
  153. data/lib/puppet/provider/package/pkg.rb +9 -6
  154. data/lib/puppet/provider/package/pkgutil.rb +3 -3
  155. data/lib/puppet/provider/package/yum.rb +1 -1
  156. data/lib/puppet/provider/parsedfile.rb +4 -4
  157. data/lib/puppet/provider/selmodule/semodule.rb +5 -3
  158. data/lib/puppet/provider/service/base.rb +1 -1
  159. data/lib/puppet/provider/service/init.rb +1 -1
  160. data/lib/puppet/provider/service/launchd.rb +2 -2
  161. data/lib/puppet/provider/service/runit.rb +2 -1
  162. data/lib/puppet/provider/service/smf.rb +2 -0
  163. data/lib/puppet/provider/service/systemd.rb +1 -0
  164. data/lib/puppet/provider/service/upstart.rb +1 -1
  165. data/lib/puppet/provider/user/aix.rb +13 -6
  166. data/lib/puppet/provider/user/openbsd.rb +2 -1
  167. data/lib/puppet/provider/yumrepo/inifile.rb +2 -1
  168. data/lib/puppet/provider/zone/solaris.rb +2 -2
  169. data/lib/puppet/reference/configuration.rb +4 -2
  170. data/lib/puppet/relationship.rb +2 -1
  171. data/lib/puppet/reports/store.rb +1 -1
  172. data/lib/puppet/resource.rb +7 -5
  173. data/lib/puppet/resource/capability_finder.rb +14 -11
  174. data/lib/puppet/resource/catalog.rb +33 -18
  175. data/lib/puppet/resource/type.rb +5 -5
  176. data/lib/puppet/settings.rb +19 -13
  177. data/lib/puppet/settings/base_setting.rb +23 -8
  178. data/lib/puppet/settings/config_file.rb +14 -4
  179. data/lib/puppet/settings/environment_conf.rb +19 -9
  180. data/lib/puppet/ssl/base.rb +9 -4
  181. data/lib/puppet/ssl/oids.rb +8 -2
  182. data/lib/puppet/syntax_checkers/base64.rb +5 -6
  183. data/lib/puppet/transaction.rb +7 -3
  184. data/lib/puppet/transaction/persistence.rb +16 -1
  185. data/lib/puppet/transaction/report.rb +6 -0
  186. data/lib/puppet/type.rb +27 -35
  187. data/lib/puppet/type/file.rb +2 -1
  188. data/lib/puppet/type/file/data_sync.rb +2 -1
  189. data/lib/puppet/type/file/source.rb +1 -1
  190. data/lib/puppet/type/group.rb +1 -1
  191. data/lib/puppet/type/mount.rb +1 -1
  192. data/lib/puppet/type/resources.rb +1 -1
  193. data/lib/puppet/type/schedule.rb +26 -14
  194. data/lib/puppet/type/user.rb +9 -3
  195. data/lib/puppet/type/zone.rb +1 -1
  196. data/lib/puppet/util.rb +27 -21
  197. data/lib/puppet/util/at_fork/solaris.rb +6 -4
  198. data/lib/puppet/util/command_line.rb +5 -0
  199. data/lib/puppet/util/command_line/trollop.rb +6 -5
  200. data/lib/puppet/util/errors.rb +61 -8
  201. data/lib/puppet/util/fileparsing.rb +3 -5
  202. data/lib/puppet/util/http_proxy.rb +14 -6
  203. data/lib/puppet/util/instance_loader.rb +1 -3
  204. data/lib/puppet/util/ldap/manager.rb +6 -3
  205. data/lib/puppet/util/log.rb +19 -24
  206. data/lib/puppet/util/logging.rb +21 -28
  207. data/lib/puppet/util/methodhelper.rb +1 -1
  208. data/lib/puppet/util/nagios_maker.rb +1 -1
  209. data/lib/puppet/util/network_device/config.rb +21 -13
  210. data/lib/puppet/util/plist.rb +3 -1
  211. data/lib/puppet/util/posix.rb +1 -1
  212. data/lib/puppet/util/provider_features.rb +1 -1
  213. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
  214. data/lib/puppet/util/reference.rb +2 -3
  215. data/lib/puppet/util/selinux.rb +1 -1
  216. data/lib/puppet/util/storage.rb +2 -2
  217. data/lib/puppet/util/windows/eventlog.rb +10 -5
  218. data/lib/puppet/util/windows/file.rb +61 -9
  219. data/lib/puppet/util/windows/process.rb +1 -1
  220. data/lib/puppet/util/windows/taskscheduler.rb +2 -2
  221. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +5 -1
  222. data/lib/puppet/version.rb +1 -1
  223. data/locales/en/puppet.po +19 -0
  224. data/locales/ja/puppet.po +2739 -809
  225. data/locales/puppet.pot +2367 -734
  226. data/spec/fixtures/unit/application/environments/production/data/common.yaml +2 -0
  227. data/spec/integration/agent/logging_spec.rb +2 -0
  228. data/spec/integration/faces/plugin_spec.rb +1 -0
  229. data/spec/integration/network/authconfig_spec.rb +2 -2
  230. data/spec/integration/parser/collection_spec.rb +2 -2
  231. data/spec/integration/parser/scope_spec.rb +16 -3
  232. data/spec/integration/provider/cron/crontab_spec.rb +1 -0
  233. data/spec/integration/transaction/report_spec.rb +5 -0
  234. data/spec/lib/matchers/json.rb +14 -13
  235. data/spec/unit/agent_spec.rb +33 -0
  236. data/spec/unit/application/config_spec.rb +4 -0
  237. data/spec/unit/application/lookup_spec.rb +30 -0
  238. data/spec/unit/application_spec.rb +18 -0
  239. data/spec/unit/configurer/downloader_factory_spec.rb +33 -0
  240. data/spec/unit/configurer/plugin_handler_spec.rb +71 -16
  241. data/spec/unit/environments_spec.rb +15 -0
  242. data/spec/unit/face/config_spec.rb +8 -9
  243. data/spec/unit/face/epp_face_spec.rb +2 -2
  244. data/spec/unit/face/plugin_spec.rb +50 -4
  245. data/spec/unit/file_serving/configuration/parser_spec.rb +2 -2
  246. data/spec/unit/file_serving/mount/locales_spec.rb +73 -0
  247. data/spec/unit/functions/break_spec.rb +108 -50
  248. data/spec/unit/functions/defined_spec.rb +2 -2
  249. data/spec/unit/functions/hiera_spec.rb +0 -1
  250. data/spec/unit/functions/lookup_spec.rb +85 -19
  251. data/spec/unit/functions/next_spec.rb +1 -1
  252. data/spec/unit/functions/return_spec.rb +2 -2
  253. data/spec/unit/gettext/config_spec.rb +125 -0
  254. data/spec/unit/gettext/module_loading_spec.rb +53 -0
  255. data/spec/unit/indirector/json_spec.rb +0 -11
  256. data/spec/unit/indirector/node/exec_spec.rb +1 -1
  257. data/spec/unit/info_service_spec.rb +1 -1
  258. data/spec/unit/interface_spec.rb +12 -0
  259. data/spec/unit/module_spec.rb +0 -28
  260. data/spec/unit/module_tool/tar/mini_spec.rb +34 -5
  261. data/spec/unit/network/http/factory_spec.rb +22 -0
  262. data/spec/unit/network/http/webrick_spec.rb +30 -29
  263. data/spec/unit/node/environment_spec.rb +16 -0
  264. data/spec/unit/node_spec.rb +102 -16
  265. data/spec/unit/parser/environment_compiler_spec.rb +1 -1
  266. data/spec/unit/parser/functions/sprintf_spec.rb +26 -0
  267. data/spec/unit/parser/resource/param_spec.rb +1 -1
  268. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +9 -9
  269. data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
  270. data/spec/unit/pops/parser/parse_containers_spec.rb +1 -1
  271. data/spec/unit/pops/types/type_calculator_spec.rb +40 -0
  272. data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
  273. data/spec/unit/provider/selmodule_spec.rb +6 -0
  274. data/spec/unit/provider/service/init_spec.rb +1 -1
  275. data/spec/unit/provider/service/smf_spec.rb +2 -0
  276. data/spec/unit/provider/service/systemd_spec.rb +14 -0
  277. data/spec/unit/resource/catalog_spec.rb +12 -2
  278. data/spec/unit/settings/config_file_spec.rb +1 -1
  279. data/spec/unit/transaction/persistence_spec.rb +42 -0
  280. data/spec/unit/transaction/report_spec.rb +19 -4
  281. data/spec/unit/transaction_spec.rb +27 -0
  282. data/spec/unit/type/schedule_spec.rb +14 -0
  283. data/spec/unit/type_spec.rb +3 -3
  284. data/spec/unit/util/errors_spec.rb +1 -1
  285. data/spec/unit/util/http_proxy_spec.rb +37 -0
  286. data/spec/unit/util/log_spec.rb +3 -3
  287. data/spec/unit/util/logging_spec.rb +7 -7
  288. data/spec/unit/util/monkey_patches_spec.rb +6 -2
  289. metadata +3445 -3416
  290. checksums.yaml +0 -7
  291. data/spec/unit/gettext_config_spec.rb +0 -57
@@ -18,5 +18,7 @@ f.one:
18
18
 
19
19
  ab: "%{hiera('a')} and %{hiera('b')}"
20
20
 
21
+ g: "This is%{facts.cx} in facts hash"
22
+
21
23
  lookup_options:
22
24
  a: first
@@ -71,6 +71,8 @@ describe 'agent logging' do
71
71
  before(:each) do
72
72
  # Don't actually run the agent, bypassing cert checks, forking and the puppet run itself
73
73
  Puppet::Application::Agent.any_instance.stubs(:run_command)
74
+ # Let exceptions be raised instead of exiting
75
+ Puppet::Application::Agent.any_instance.stubs(:exit_on_fail).yields
74
76
  end
75
77
 
76
78
  def double_of_bin_puppet_agent_call(argv)
@@ -28,6 +28,7 @@ describe "Puppet plugin face" do
28
28
  before do
29
29
  FileUtils.mkdir(File.join(Puppet[:vardir], 'lib'))
30
30
  FileUtils.mkdir(File.join(Puppet[:vardir], 'facts.d'))
31
+ FileUtils.mkdir(File.join(Puppet[:vardir], 'locales'))
31
32
  @termini_classes = {}
32
33
  INDIRECTED_CLASSES.each do |indirected|
33
34
  @termini_classes[indirected] = indirected.indirection.terminus_class
@@ -97,13 +97,13 @@ describe Puppet::Network::AuthConfig do
97
97
  it 'should warn about missing path before allow_ip in stanza' do
98
98
  expect {
99
99
  add_raw_stanza("allow_ip 10.0.0.1\n")
100
- }.to raise_error Puppet::ConfigurationError, /Missing or invalid 'path' before right directive at line.*/
100
+ }.to raise_error Puppet::ConfigurationError, /Missing or invalid 'path' before right directive at \(line: .*\)/
101
101
  end
102
102
 
103
103
  it 'should warn about missing path before allow in stanza' do
104
104
  expect {
105
105
  add_raw_stanza("allow host.domain.com\n")
106
- }.to raise_error Puppet::ConfigurationError, /Missing or invalid 'path' before right directive at line.*/
106
+ }.to raise_error Puppet::ConfigurationError, /Missing or invalid 'path' before right directive at \(line: .*\)/
107
107
  end
108
108
 
109
109
  it "should support hostname backreferences" do
@@ -342,13 +342,13 @@ describe 'collectors' do
342
342
  Puppet[:strict] = :warning
343
343
  expect_the_message_to_be(['given'], manifest)
344
344
  expect(warnings).to include(
345
- /Attempt to override an already evaluated resource, defined at line 4, with new values at line 6/)
345
+ /Attempt to override an already evaluated resource, defined at \(line: 4\), with new values \(line: 6\)/)
346
346
  end
347
347
 
348
348
  it 'and --strict=error, it fails compilation' do
349
349
  Puppet[:strict] = :error
350
350
  expect { compile_to_catalog(manifest) }.to raise_error(
351
- /Attempt to override an already evaluated resource, defined at line 4, with new values at line 6/)
351
+ /Attempt to override an already evaluated resource, defined at \(line: 4\), with new values \(line: 6\)/)
352
352
  expect(warnings).to be_empty
353
353
  end
354
354
  end
@@ -47,7 +47,7 @@ describe "Two step scoping for variables" do
47
47
  compile_to_catalog("$name = 'never in a 0xF4240 years'", enc_node)
48
48
  }.to raise_error(
49
49
  Puppet::Error,
50
- /Cannot reassign built in \(or already assigned\) variable '\$name' at line 1(\:7)? on node the_node/
50
+ /Cannot reassign built in \(or already assigned\) variable '\$name' \(line: 1(, column: 7)?\) on node the_node/
51
51
  )
52
52
  end
53
53
 
@@ -58,7 +58,7 @@ describe "Two step scoping for variables" do
58
58
  compile_to_catalog("$title = 'never in a 0xF4240 years'", enc_node)
59
59
  }.to raise_error(
60
60
  Puppet::Error,
61
- /Cannot reassign built in \(or already assigned\) variable '\$title' at line 1(\:8)? on node the_node/
61
+ /Cannot reassign built in \(or already assigned\) variable '\$title' \(line: 1(, column: 8)?\) on node the_node/
62
62
  )
63
63
  end
64
64
 
@@ -316,6 +316,19 @@ describe "Two step scoping for variables" do
316
316
  end
317
317
  end
318
318
 
319
+ it 'resolves a qualified name in class parameter scope' do
320
+ expect_the_message_to_be('Does it work? Yes!') do <<-PUPPET
321
+ class a (
322
+ $var1 = 'Does it work?',
323
+ $var2 = "${a::var1} Yes!"
324
+ ) {
325
+ notify { 'something': message => $var2 }
326
+ }
327
+ include a
328
+ PUPPET
329
+ end
330
+ end
331
+
319
332
  it "finds values in its inherited scope when the inherited class is qualified to the top" do
320
333
  expect_the_message_to_be('foo_msg') do <<-MANIFEST
321
334
  node default {
@@ -682,7 +695,7 @@ describe "Two step scoping for variables" do
682
695
  compile_to_catalog("$var = 'top scope'", enc_node)
683
696
  }.to raise_error(
684
697
  Puppet::Error,
685
- /Cannot reassign variable '\$var' at line 1(\:6)? on node the_node/
698
+ /Cannot reassign variable '\$var' \(line: 1(, column: 6)?\) on node the_node/
686
699
  )
687
700
  end
688
701
 
@@ -10,6 +10,7 @@ describe Puppet::Type.type(:cron).provider(:crontab), '(integration)', :unless =
10
10
 
11
11
  before :each do
12
12
  Puppet::Type.type(:cron).stubs(:defaultprovider).returns described_class
13
+ described_class.stubs(:suitable?).returns true
13
14
  Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # Don't backup to filebucket
14
15
 
15
16
  # I don't want to execute anything
@@ -3,6 +3,11 @@ require 'spec_helper'
3
3
  require 'puppet_spec/files'
4
4
 
5
5
  describe Puppet::Transaction::Report do
6
+ before :each do
7
+ # Enable persistence during tests
8
+ Puppet::Transaction::Persistence.any_instance.stubs(:enabled?).returns(true)
9
+ end
10
+
6
11
  describe "when using the indirector" do
7
12
  after do
8
13
  Puppet.settings.stubs(:use)
@@ -28,6 +28,7 @@ module JSONMatchers
28
28
  end
29
29
 
30
30
  def matches?(instance)
31
+ @instance = instance
31
32
  result = attr_value(@attributes, instance)
32
33
  if @value
33
34
  result == @value
@@ -36,19 +37,19 @@ module JSONMatchers
36
37
  end
37
38
  end
38
39
 
39
- def failure_message(instance)
40
+ def failure_message
40
41
  if @value
41
- "expected #{instance.inspect} to set #{@attributes.inspect} to #{@value.inspect}; got #{attr_value(@attributes, instance).inspect}"
42
+ "expected #{@instance.inspect} to set #{@attributes.inspect} to #{@value.inspect}; got #{attr_value(@attributes, @instance).inspect}"
42
43
  else
43
- "expected #{instance.inspect} to set #{@attributes.inspect} but was nil"
44
+ "expected #{@instance.inspect} to set #{@attributes.inspect} but was nil"
44
45
  end
45
46
  end
46
47
 
47
- def failure_message_when_negated(instance)
48
+ def failure_message_when_negated
48
49
  if @value
49
- "expected #{instance.inspect} not to set #{@attributes.inspect} to #{@value.inspect}"
50
+ "expected #{@instance.inspect} not to set #{@attributes.inspect} to #{@value.inspect}"
50
51
  else
51
- "expected #{instance.inspect} not to set #{@attributes.inspect} to nil"
52
+ "expected #{@instance.inspect} not to set #{@attributes.inspect} to nil"
52
53
  end
53
54
  end
54
55
  end
@@ -74,7 +75,7 @@ module JSONMatchers
74
75
 
75
76
  def matches?(klass)
76
77
  raise "Must specify json with 'from'" unless @json
77
-
78
+ @klass = klass
78
79
  @instance = format.intern(klass, @json)
79
80
  if @value
80
81
  @instance.send(@attribute) == @value
@@ -83,19 +84,19 @@ module JSONMatchers
83
84
  end
84
85
  end
85
86
 
86
- def failure_message(klass)
87
+ def failure_message
87
88
  if @value
88
- "expected #{klass} to read #{@attribute} from #{@json} as #{@value.inspect}; got #{@instance.send(@attribute).inspect}"
89
+ "expected #{@klass} to read #{@attribute} from #{@json} as #{@value.inspect}; got #{@instance.send(@attribute).inspect}"
89
90
  else
90
- "expected #{klass} to read #{@attribute} from #{@json} but was nil"
91
+ "expected #{@klass} to read #{@attribute} from #{@json} but was nil"
91
92
  end
92
93
  end
93
94
 
94
- def failure_message_when_negated(klass)
95
+ def failure_message_when_negated
95
96
  if @value
96
- "expected #{klass} not to set #{@attribute} to #{@value}"
97
+ "expected #{@klass} not to set #{@attribute} to #{@value}"
97
98
  else
98
- "expected #{klass} not to set #{@attribute} to nil"
99
+ "expected #{@klass} not to set #{@attribute} to nil"
99
100
  end
100
101
  end
101
102
  end
@@ -258,6 +258,39 @@ describe Puppet::Agent do
258
258
  expect(agent.should_fork).to be_falsey
259
259
  end
260
260
  end
261
+
262
+ describe 'when runtimeout is set' do
263
+ before(:each) do
264
+ Puppet[:runtimeout] = 1
265
+ end
266
+
267
+ it 'times out when a run exceeds the set limit' do
268
+ client = AgentTestClient.new
269
+ client.instance_eval do
270
+ # Stub methods used to set test expectations.
271
+ def processing; end
272
+ def handling; end
273
+
274
+ def run(client_options = {})
275
+ # Simulate a hanging agent operation that also traps errors.
276
+ begin
277
+ ::Kernel.sleep(5)
278
+ processing()
279
+ rescue
280
+ handling()
281
+ end
282
+ end
283
+ end
284
+
285
+ AgentTestClient.expects(:new).returns client
286
+
287
+ client.expects(:processing).never
288
+ client.expects(:handling).never
289
+ Puppet.expects(:log_exception).with(instance_of(Puppet::Agent::RunTimeoutError), anything)
290
+
291
+ expect(@agent.run).to eq(1)
292
+ end
293
+ end
261
294
  end
262
295
 
263
296
  describe "when checking execution state" do
@@ -6,4 +6,8 @@ describe Puppet::Application::Config do
6
6
  it "should be a subclass of Puppet::Application::FaceBase" do
7
7
  expect(Puppet::Application::Config.superclass).to equal(Puppet::Application::FaceBase)
8
8
  end
9
+
10
+ it "should set `environment_mode` to :not_required" do
11
+ expect(Puppet::Application::Config.get_environment_mode).to equal(:not_required)
12
+ end
9
13
  end
@@ -498,6 +498,8 @@ Searching for "a"
498
498
  end
499
499
 
500
500
  context 'the global scope' do
501
+ include PuppetSpec::Files
502
+
501
503
  it "is unaffected by global variables unless '--compile' is used" do
502
504
  lookup.options[:node] = node
503
505
  lookup.command_line.stubs(:args).returns(['c'])
@@ -510,6 +512,34 @@ Searching for "a"
510
512
  lookup.command_line.stubs(:args).returns(['c'])
511
513
  expect(run_lookup(lookup)).to eql("--- This is C from site.pp\n...")
512
514
  end
515
+
516
+ it 'receives extra facts in top scope' do
517
+ file_path = tmpdir('lookup_spec')
518
+ filename = File.join(file_path, "facts.yaml")
519
+ File.open(filename, "w+") { |f| f.write(<<-YAML.unindent) }
520
+ ---
521
+ cx: ' C from facts'
522
+ YAML
523
+
524
+ lookup.options[:node] = node
525
+ lookup.options[:fact_file] = filename
526
+ lookup.command_line.stubs(:args).returns(['c'])
527
+ expect(run_lookup(lookup)).to eql("--- This is C from facts\n...")
528
+ end
529
+
530
+ it 'receives extra facts in the facts hash' do
531
+ file_path = tmpdir('lookup_spec')
532
+ filename = File.join(file_path, "facts.yaml")
533
+ File.open(filename, "w+") { |f| f.write(<<-YAML.unindent) }
534
+ ---
535
+ cx: ' G from facts'
536
+ YAML
537
+
538
+ lookup.options[:node] = node
539
+ lookup.options[:fact_file] = filename
540
+ lookup.command_line.stubs(:args).returns(['g'])
541
+ expect(run_lookup(lookup)).to eql("--- This is G from facts in facts hash\n...")
542
+ end
513
543
  end
514
544
 
515
545
  context 'using a puppet function as data provider' do
@@ -99,6 +99,24 @@ describe Puppet::Application do
99
99
  end
100
100
  end
101
101
 
102
+ describe ".environment_mode" do
103
+ it "should default to :local" do
104
+ expect(@appclass.get_environment_mode).to eq(:local)
105
+ end
106
+
107
+ it "should set and get a value" do
108
+ @appclass.environment_mode :remote
109
+ expect(@appclass.get_environment_mode).to eq(:remote)
110
+ end
111
+
112
+ it "should error if given a random symbol" do
113
+ expect{@appclass.environment_mode :foo}.to raise_error(/Invalid environment mode/)
114
+ end
115
+
116
+ it "should error if given a string" do
117
+ expect{@appclass.environment_mode 'local'}.to raise_error(/Invalid environment mode/)
118
+ end
119
+ end
102
120
 
103
121
 
104
122
  # These tests may look a little weird and repetative in its current state;
@@ -14,6 +14,10 @@ describe Puppet::Configurer::DownloaderFactory do
14
14
  factory.create_plugin_facts_downloader(environment)
15
15
  end
16
16
 
17
+ let(:locales_downloader) do
18
+ factory.create_locales_downloader(environment)
19
+ end
20
+
17
21
  def ignores_source_permissions(downloader)
18
22
  expect(downloader.file[:source_permissions]).to eq(:ignore)
19
23
  end
@@ -93,4 +97,33 @@ describe Puppet::Configurer::DownloaderFactory do
93
97
  end
94
98
  end
95
99
  end
100
+
101
+ context "when creating a plugin downloader for module translations" do
102
+ it 'is named "locales"' do
103
+ expect(locales_downloader.name).to eq('locales')
104
+ end
105
+
106
+ it 'downloads files into Puppet[:localedest]' do
107
+ localedest = File.expand_path("/tmp/ldest")
108
+ Puppet[:localedest] = localedest
109
+
110
+ expect(locales_downloader.file[:path]).to eq(localedest)
111
+ end
112
+
113
+ it 'downloads files from Puppet[:localesource]' do
114
+ Puppet[:localesource] = 'puppet:///myotherlocales'
115
+
116
+ expect(locales_downloader.file[:source]).to eq([Puppet[:localesource]])
117
+ end
118
+
119
+ it 'ignores files from Puppet[:pluginsignore], plus config.yaml' do
120
+ Puppet[:pluginsignore] = 'lignore'
121
+
122
+ expect(locales_downloader.file[:ignore]).to eq(['lignore', 'config.yaml'])
123
+ end
124
+
125
+ it "ignores source permissions" do
126
+ ignores_source_permissions(locales_downloader)
127
+ end
128
+ end
96
129
  end
@@ -8,29 +8,84 @@ describe Puppet::Configurer::PluginHandler do
8
8
  let(:pluginhandler) { Puppet::Configurer::PluginHandler.new(factory) }
9
9
  let(:environment) { Puppet::Node::Environment.create(:myenv, []) }
10
10
 
11
- before :each do
12
- # PluginHandler#load_plugin has an extra-strong rescue clause
13
- # this mock is to make sure that we don't silently ignore errors
14
- Puppet.expects(:err).never
11
+
12
+ context "server agent version is 5.3.4" do
13
+
14
+ before :each do
15
+ # PluginHandler#load_plugin has an extra-strong rescue clause
16
+ # this mock is to make sure that we don't silently ignore errors
17
+ Puppet.expects(:err).never
18
+ # Server_agent version needs to be at 5.3.4 in order to mount locales
19
+ Puppet.push_context({:server_agent_version => "5.3.4"})
20
+ end
21
+
22
+ it "downloads plugins, facts, and locales" do
23
+ plugin_downloader = stub('plugin-downloader', :evaluate => [])
24
+ facts_downloader = stub('facts-downloader', :evaluate => [])
25
+ locales_downloader = stub('locales-downloader', :evaluate => [])
26
+
27
+ factory.expects(:create_plugin_downloader).returns(plugin_downloader)
28
+ factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)
29
+ factory.expects(:create_locales_downloader).returns(locales_downloader)
30
+
31
+ pluginhandler.download_plugins(environment)
32
+ end
33
+
34
+ it "returns downloaded plugin, fact, and locale filenames" do
35
+ plugin_downloader = stub('plugin-downloader', :evaluate => %w[/a])
36
+ facts_downloader = stub('facts-downloader', :evaluate => %w[/b])
37
+ locales_downloader = stub('locales-downloader', :evaluate => %w[/c])
38
+
39
+ factory.expects(:create_plugin_downloader).returns(plugin_downloader)
40
+ factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)
41
+ factory.expects(:create_locales_downloader).returns(locales_downloader)
42
+
43
+ expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b /c])
44
+ end
15
45
  end
16
46
 
17
- it "downloads plugins and facts" do
18
- plugin_downloader = stub('plugin-downloader', :evaluate => [])
19
- facts_downloader = stub('facts-downloader', :evaluate => [])
47
+ context "server agent version is 5.3.3" do
48
+
49
+ before :each do
50
+ # PluginHandler#load_plugin has an extra-strong rescue clause
51
+ # this mock is to make sure that we don't silently ignore errors
52
+ Puppet.expects(:err).never
53
+ # Server_agent version needs to be at 5.3.4 in order to mount locales
54
+ Puppet.push_context({:server_agent_version => "5.3.3"})
55
+ end
20
56
 
21
- factory.expects(:create_plugin_downloader).returns(plugin_downloader)
22
- factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)
57
+ it "returns downloaded plugin, fact, but not locale filenames" do
58
+ plugin_downloader = stub('plugin-downloader', :evaluate => %w[/a])
59
+ facts_downloader = stub('facts-downloader', :evaluate => %w[/b])
23
60
 
24
- pluginhandler.download_plugins(environment)
61
+ factory.expects(:create_plugin_downloader).returns(plugin_downloader)
62
+ factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)
63
+ factory.expects(:create_locales_downloader).never
64
+
65
+ expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
66
+ end
25
67
  end
26
68
 
27
- it "returns downloaded plugin and fact filenames" do
28
- plugin_downloader = stub('plugin-downloader', :evaluate => %w[/a])
29
- facts_downloader = stub('facts-downloader', :evaluate => %w[/b])
69
+ context "blank server agent version" do
70
+ before :each do
71
+ # PluginHandler#load_plugin has an extra-strong rescue clause
72
+ # this mock is to make sure that we don't silently ignore errors
73
+ Puppet.expects(:err).never
74
+ # Server_agent version needs to be at 5.3.4 in order to mount locales
75
+ # A blank version will default to 0.0
76
+ Puppet.push_context({:server_agent_version => ""})
77
+ end
78
+
79
+ it "returns downloaded plugin, fact, but not locale filenames" do
80
+ plugin_downloader = stub('plugin-downloader', :evaluate => %w[/a])
81
+ facts_downloader = stub('facts-downloader', :evaluate => %w[/b])
82
+
83
+ factory.expects(:create_plugin_downloader).returns(plugin_downloader)
84
+ factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)
85
+ factory.expects(:create_locales_downloader).never
30
86
 
31
- factory.expects(:create_plugin_downloader).returns(plugin_downloader)
32
- factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)
87
+ expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
88
+ end
33
89
 
34
- expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
35
90
  end
36
91
  end