puppet 6.18.0-x86-mingw32 → 6.19.0-x86-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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -10
  3. data/README.md +1 -2
  4. data/Rakefile +4 -12
  5. data/lib/puppet/agent/locker.rb +0 -7
  6. data/lib/puppet/application/agent.rb +8 -3
  7. data/lib/puppet/application/doc.rb +1 -1
  8. data/lib/puppet/application/lookup.rb +5 -5
  9. data/lib/puppet/configurer.rb +39 -7
  10. data/lib/puppet/defaults.rb +55 -29
  11. data/lib/puppet/environments.rb +51 -10
  12. data/lib/puppet/face/catalog.rb +1 -1
  13. data/lib/puppet/face/config.rb +46 -16
  14. data/lib/puppet/face/node.rb +3 -3
  15. data/lib/puppet/face/node/clean.rb +2 -2
  16. data/lib/puppet/face/status.rb +1 -1
  17. data/lib/puppet/file_bucket/dipper.rb +1 -1
  18. data/lib/puppet/functions/new.rb +8 -3
  19. data/lib/puppet/http.rb +1 -0
  20. data/lib/puppet/http/client.rb +1 -1
  21. data/lib/puppet/http/resolver.rb +5 -8
  22. data/lib/puppet/http/resolver/server_list.rb +18 -36
  23. data/lib/puppet/http/resolver/settings.rb +4 -4
  24. data/lib/puppet/http/resolver/srv.rb +5 -5
  25. data/lib/puppet/http/service.rb +3 -1
  26. data/lib/puppet/http/service/compiler.rb +1 -1
  27. data/lib/puppet/http/service/file_server.rb +1 -1
  28. data/lib/puppet/http/service/puppetserver.rb +39 -0
  29. data/lib/puppet/http/session.rb +5 -4
  30. data/lib/puppet/indirector/catalog/compiler.rb +1 -1
  31. data/lib/puppet/indirector/facts/yaml.rb +1 -1
  32. data/lib/puppet/indirector/json.rb +1 -1
  33. data/lib/puppet/indirector/msgpack.rb +1 -1
  34. data/lib/puppet/indirector/request.rb +4 -4
  35. data/lib/puppet/indirector/yaml.rb +1 -1
  36. data/lib/puppet/network/http/api/master/v3/environments.rb +0 -1
  37. data/lib/puppet/node/facts.rb +17 -0
  38. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
  39. data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
  40. data/lib/puppet/pops/types/p_meta_type.rb +1 -1
  41. data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
  42. data/lib/puppet/provider/package/dpkg.rb +1 -1
  43. data/lib/puppet/provider/package/pip2.rb +17 -0
  44. data/lib/puppet/provider/package/puppetserver_gem.rb +180 -0
  45. data/lib/puppet/provider/package/yum.rb +1 -0
  46. data/lib/puppet/resource/type.rb +2 -1
  47. data/lib/puppet/rest/route.rb +2 -2
  48. data/lib/puppet/settings.rb +19 -5
  49. data/lib/puppet/transaction/report.rb +11 -7
  50. data/lib/puppet/type/file/source.rb +1 -1
  51. data/lib/puppet/type/filebucket.rb +1 -1
  52. data/lib/puppet/util/connection.rb +8 -8
  53. data/lib/puppet/util/run_mode.rb +5 -1
  54. data/lib/puppet/version.rb +1 -1
  55. data/locales/puppet.pot +153 -156
  56. data/man/man5/puppet.conf.5 +29 -13
  57. data/man/man8/puppet-agent.8 +6 -3
  58. data/man/man8/puppet-apply.8 +1 -1
  59. data/man/man8/puppet-catalog.8 +1 -1
  60. data/man/man8/puppet-config.8 +6 -6
  61. data/man/man8/puppet-describe.8 +1 -1
  62. data/man/man8/puppet-device.8 +1 -1
  63. data/man/man8/puppet-doc.8 +1 -1
  64. data/man/man8/puppet-epp.8 +1 -1
  65. data/man/man8/puppet-facts.8 +1 -1
  66. data/man/man8/puppet-filebucket.8 +1 -1
  67. data/man/man8/puppet-generate.8 +1 -1
  68. data/man/man8/puppet-help.8 +1 -1
  69. data/man/man8/puppet-key.8 +1 -1
  70. data/man/man8/puppet-lookup.8 +1 -1
  71. data/man/man8/puppet-man.8 +1 -1
  72. data/man/man8/puppet-module.8 +1 -1
  73. data/man/man8/puppet-node.8 +4 -4
  74. data/man/man8/puppet-parser.8 +1 -1
  75. data/man/man8/puppet-plugin.8 +1 -1
  76. data/man/man8/puppet-report.8 +1 -1
  77. data/man/man8/puppet-resource.8 +1 -1
  78. data/man/man8/puppet-script.8 +1 -1
  79. data/man/man8/puppet-ssl.8 +1 -1
  80. data/man/man8/puppet-status.8 +2 -2
  81. data/man/man8/puppet.8 +2 -2
  82. data/spec/fixtures/unit/provider/package/puppetserver_gem/gem-list-local-packages +30 -0
  83. data/spec/integration/application/agent_spec.rb +23 -19
  84. data/spec/integration/application/filebucket_spec.rb +7 -7
  85. data/spec/integration/application/plugin_spec.rb +3 -3
  86. data/spec/integration/configurer_spec.rb +14 -0
  87. data/spec/integration/defaults_spec.rb +26 -1
  88. data/spec/integration/util/windows/adsi_spec.rb +2 -2
  89. data/spec/shared_contexts/types_setup.rb +2 -0
  90. data/spec/unit/application/doc_spec.rb +2 -2
  91. data/spec/unit/application/facts_spec.rb +3 -1
  92. data/spec/unit/application_spec.rb +9 -4
  93. data/spec/unit/configurer_spec.rb +39 -6
  94. data/spec/unit/environments_spec.rb +99 -32
  95. data/spec/unit/face/config_spec.rb +56 -0
  96. data/spec/unit/face/node_spec.rb +2 -2
  97. data/spec/unit/file_system_spec.rb +1 -2
  98. data/spec/unit/http/resolver_spec.rb +24 -4
  99. data/spec/unit/http/service/ca_spec.rb +2 -2
  100. data/spec/unit/http/service/compiler_spec.rb +2 -2
  101. data/spec/unit/http/service/file_server_spec.rb +2 -2
  102. data/spec/unit/http/service/puppetserver_spec.rb +82 -0
  103. data/spec/unit/http/service/report_spec.rb +2 -2
  104. data/spec/unit/http/session_spec.rb +8 -20
  105. data/spec/unit/indirector/catalog/json_spec.rb +1 -1
  106. data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
  107. data/spec/unit/indirector/facts/rest_spec.rb +1 -1
  108. data/spec/unit/indirector/json_spec.rb +8 -8
  109. data/spec/unit/indirector/msgpack_spec.rb +8 -8
  110. data/spec/unit/indirector/node/rest_spec.rb +1 -1
  111. data/spec/unit/indirector/request_spec.rb +4 -4
  112. data/spec/unit/indirector/rest_spec.rb +1 -1
  113. data/spec/unit/indirector/status/rest_spec.rb +1 -1
  114. data/spec/unit/indirector/yaml_spec.rb +7 -7
  115. data/spec/unit/network/http/api/master/v3/environments_spec.rb +12 -23
  116. data/spec/unit/provider/exec_spec.rb +4 -3
  117. data/spec/unit/provider/package/dpkg_spec.rb +22 -7
  118. data/spec/unit/provider/package/openbsd_spec.rb +2 -0
  119. data/spec/unit/provider/package/pip2_spec.rb +36 -0
  120. data/spec/unit/provider/package/puppetserver_gem_spec.rb +137 -0
  121. data/spec/unit/provider/package/yum_spec.rb +31 -0
  122. data/spec/unit/provider/service/base_spec.rb +2 -4
  123. data/spec/unit/provider/service/bsd_spec.rb +5 -1
  124. data/spec/unit/provider/service/daemontools_spec.rb +1 -1
  125. data/spec/unit/provider/service/debian_spec.rb +3 -5
  126. data/spec/unit/provider/service/freebsd_spec.rb +1 -1
  127. data/spec/unit/provider/service/gentoo_spec.rb +4 -5
  128. data/spec/unit/provider/service/init_spec.rb +4 -5
  129. data/spec/unit/provider/service/launchd_spec.rb +5 -6
  130. data/spec/unit/provider/service/openrc_spec.rb +4 -5
  131. data/spec/unit/provider/service/openwrt_spec.rb +1 -1
  132. data/spec/unit/provider/service/redhat_spec.rb +1 -1
  133. data/spec/unit/provider/service/runit_spec.rb +2 -1
  134. data/spec/unit/provider/service/smf_spec.rb +1 -1
  135. data/spec/unit/provider/service/src_spec.rb +3 -5
  136. data/spec/unit/provider/service/systemd_spec.rb +3 -1
  137. data/spec/unit/provider/service/upstart_spec.rb +4 -5
  138. data/spec/unit/rest/route_spec.rb +4 -4
  139. data/spec/unit/settings_spec.rb +44 -22
  140. data/spec/unit/transaction/report_spec.rb +2 -0
  141. data/spec/unit/type/file/source_spec.rb +1 -1
  142. data/spec/unit/type/filebucket_spec.rb +1 -1
  143. data/spec/unit/util/run_mode_spec.rb +6 -6
  144. metadata +13 -2
@@ -0,0 +1,30 @@
1
+ concurrent-ruby (1.1.5)
2
+
3
+ deep_merge (1.0.1)
4
+
5
+ fast_gettext (1.1.2)
6
+
7
+ gettext (3.2.2)
8
+
9
+ hiera-eyaml (3.2.0)
10
+
11
+ highline (1.6.21)
12
+
13
+ hocon (1.3.1, 1.2.5)
14
+
15
+ locale (2.1.3, 2.1.2)
16
+
17
+ multi_json (1.14.1)
18
+
19
+ optimist (3.0.1)
20
+
21
+ puppet-resource_api (1.8.13)
22
+
23
+ puppetserver-ca (1.8.0)
24
+
25
+ semantic_puppet (1.0.2)
26
+
27
+ text (1.3.1)
28
+
29
+ world_airports (1.1.3)
30
+
@@ -15,15 +15,12 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
15
15
  let(:formatter) { Puppet::Network::FormatHandler.format(:rich_data_json) }
16
16
 
17
17
  context 'server_list' do
18
- before :each do
19
- Puppet[:log_level] = 'debug'
20
- end
21
-
22
18
  it "uses the first server in the list" do
23
19
  Puppet[:server_list] = '127.0.0.1'
20
+ Puppet[:log_level] = 'debug'
24
21
 
25
22
  server.start_server do |port|
26
- Puppet[:masterport] = port
23
+ Puppet[:serverport] = port
27
24
  expect {
28
25
  agent.command_line.args << '--test'
29
26
  agent.run
@@ -36,15 +33,17 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
36
33
  Puppet[:server_list] = "puppet.example.com,#{Puppet[:server]}"
37
34
 
38
35
  server.start_server do |port|
39
- Puppet[:masterport] = port
36
+ Puppet[:serverport] = port
40
37
  expect {
41
38
  agent.command_line.args << '--test'
42
39
  agent.run
43
40
  }.to exit_with(0)
44
- .and output(%r{Unable to connect to server from server_list setting: Request to https://puppet.example.com:#{port}/status/v1/simple/master failed}).to_stdout
41
+ .and output(%r{Notice: Applied catalog}).to_stdout
42
+ .and output(%r{Unable to connect to server from server_list setting: Request to https://puppet.example.com:#{port}/status/v1/simple/master failed}).to_stderr
45
43
 
46
44
  report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport]))
47
45
  expect(report.master_used).to eq("127.0.0.1:#{port}")
46
+ expect(report.server_used).to eq("127.0.0.1:#{port}")
48
47
  end
49
48
  end
50
49
 
@@ -55,17 +54,19 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
55
54
  agent.command_line.args << '--test'
56
55
  agent.run
57
56
  }.to exit_with(1)
58
- .and output(%r{Unable to connect to server from server_list setting: Could not select a functional puppet master from server_list: 'puppet.example.com'}).to_stdout
59
- .and output(/Error: Could not run Puppet configuration client: Could not select a functional puppet master from server_list: 'puppet.example.com'/).to_stderr
57
+ .and output(a_string_matching(%r{Unable to connect to server from server_list setting})
58
+ .and matching(/Error: Could not run Puppet configuration client: Could not select a functional puppet server from server_list: 'puppet.example.com'/)).to_stderr
60
59
 
61
60
  # I'd expect puppet to update the last run report even if the server_list was
62
61
  # exhausted, but it doesn't work that way currently, see PUP-6708
63
62
  expect(File).to_not be_exist(Puppet[:lastrunreport])
64
63
  end
65
64
 
66
- it "omits master_used when not using server_list" do
65
+ it "omits server_used when not using server_list" do
66
+ Puppet[:log_level] = 'debug'
67
+
67
68
  server.start_server do |port|
68
- Puppet[:masterport] = port
69
+ Puppet[:serverport] = port
69
70
  expect {
70
71
  agent.command_line.args << '--test'
71
72
  agent.run
@@ -75,10 +76,12 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
75
76
 
76
77
  report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport]))
77
78
  expect(report.master_used).to be_nil
79
+ expect(report.server_used).to be_nil
78
80
  end
79
81
 
80
82
  it "server_list takes precedence over server" do
81
83
  Puppet[:server] = 'notvalid.example.com'
84
+ Puppet[:log_level] = 'debug'
82
85
 
83
86
  server.start_server do |port|
84
87
  Puppet[:server_list] = "127.0.0.1:#{port}"
@@ -91,6 +94,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
91
94
 
92
95
  report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport]))
93
96
  expect(report.master_used).to eq("127.0.0.1:#{port}")
97
+ expect(report.server_used).to eq("127.0.0.1:#{port}")
94
98
  end
95
99
  end
96
100
  end
@@ -109,7 +113,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
109
113
  }
110
114
 
111
115
  server.start_server(mounts: {catalog: catalog_handler}) do |port|
112
- Puppet[:masterport] = port
116
+ Puppet[:serverport] = port
113
117
  expect {
114
118
  agent.command_line.args << '--test'
115
119
  agent.run
@@ -131,7 +135,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
131
135
  }
132
136
 
133
137
  server.start_server(mounts: {catalog: catalog_handler}) do |port|
134
- Puppet[:masterport] = port
138
+ Puppet[:serverport] = port
135
139
  expect {
136
140
  agent.command_line.args << '--test'
137
141
  agent.run
@@ -195,7 +199,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
195
199
  }
196
200
 
197
201
  server.start_server(mounts: {catalog: catalog_handler}) do |port|
198
- Puppet[:masterport] = port
202
+ Puppet[:serverport] = port
199
203
  expect {
200
204
  expect {
201
205
  agent.command_line.args << '--test'
@@ -240,7 +244,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
240
244
  }
241
245
 
242
246
  server.start_server(mounts: mounts) do |port|
243
- Puppet[:masterport] = port
247
+ Puppet[:serverport] = port
244
248
  expect {
245
249
  agent.command_line.args << '--test'
246
250
  agent.run
@@ -288,7 +292,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
288
292
  }
289
293
 
290
294
  server.start_server(mounts: {catalog: catalog_handler}) do |puppetserver_port|
291
- Puppet[:masterport] = puppetserver_port
295
+ Puppet[:serverport] = puppetserver_port
292
296
 
293
297
  # override path to system cacert bundle, this must be done before
294
298
  # the SSLContext is created and the call to X509::Store.set_default_paths
@@ -340,7 +344,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
340
344
  }
341
345
 
342
346
  server.start_server(mounts: {catalog: catalog_handler}) do |puppetserver_port|
343
- Puppet[:masterport] = puppetserver_port
347
+ Puppet[:serverport] = puppetserver_port
344
348
 
345
349
  # override path to system cacert bundle, this must be done before
346
350
  # the SSLContext is created and the call to X509::Store.set_default_paths
@@ -391,7 +395,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
391
395
  }
392
396
 
393
397
  server.start_server(mounts: {catalog: catalog_handler}) do |puppetserver_port|
394
- Puppet[:masterport] = puppetserver_port
398
+ Puppet[:serverport] = puppetserver_port
395
399
 
396
400
  # set path to external cacert bundle, this must be done before
397
401
  # the SSLContext is created
@@ -431,7 +435,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
431
435
  it "waits for other agent run to finish before starting" do
432
436
  server.start_server do |port|
433
437
  path = Puppet[:agent_catalog_run_lockfile]
434
- Puppet[:masterport] = port
438
+ Puppet[:serverport] = port
435
439
  Puppet[:waitforlock] = 1
436
440
 
437
441
  th = Thread.new {
@@ -35,7 +35,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
35
35
 
36
36
  it "backs up text files to the filebucket server" do
37
37
  server.start_server do |port|
38
- Puppet[:masterport] = port
38
+ Puppet[:serverport] = port
39
39
  expect {
40
40
  filebucket.command_line.args = ['backup', backup_file]
41
41
  filebucket.run
@@ -56,7 +56,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
56
56
  File.binwrite(backup_file, binary)
57
57
 
58
58
  server.start_server do |port|
59
- Puppet[:masterport] = port
59
+ Puppet[:serverport] = port
60
60
  expect {
61
61
  filebucket.command_line.args = ['backup', backup_file]
62
62
  filebucket.run
@@ -75,7 +75,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
75
75
  File.binwrite(backup_file, utf8)
76
76
 
77
77
  server.start_server do |port|
78
- Puppet[:masterport] = port
78
+ Puppet[:serverport] = port
79
79
  expect {
80
80
  filebucket.command_line.args = ['backup', backup_file]
81
81
  filebucket.run
@@ -95,7 +95,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
95
95
  }
96
96
 
97
97
  server.start_server(mounts: {filebucket: file_exists_handler}) do |port|
98
- Puppet[:masterport] = port
98
+ Puppet[:serverport] = port
99
99
  expect {
100
100
  filebucket.command_line.args = ['backup', backup_file]
101
101
  filebucket.run
@@ -114,7 +114,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
114
114
  }
115
115
 
116
116
  server.start_server(mounts: {filebucket: get_handler}) do |port|
117
- Puppet[:masterport] = port
117
+ Puppet[:serverport] = port
118
118
  expect {
119
119
  filebucket.command_line.args = ['get', 'fac251367c9e083c6b1f0f3181']
120
120
  filebucket.run
@@ -137,7 +137,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
137
137
  }
138
138
 
139
139
  server.start_server(mounts: {filebucket: get_handler}) do |port|
140
- Puppet[:masterport] = port
140
+ Puppet[:serverport] = port
141
141
  expect {
142
142
  filebucket.command_line.args = ['diff', 'fac251367c9e083c6b1f0f3181', backup_file, '--remote']
143
143
  filebucket.run
@@ -165,7 +165,7 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
165
165
  }
166
166
 
167
167
  server.start_server(mounts: {filebucket: get_handler}) do |port|
168
- Puppet[:masterport] = port
168
+ Puppet[:serverport] = port
169
169
  expect {
170
170
  filebucket.command_line.args = ['diff', 'd3b07384d113edec49eaa6238ad5ff00', "99b999207e287afffc86c053e5693247", '--remote']
171
171
  filebucket.run
@@ -17,7 +17,7 @@ describe "puppet plugin" do
17
17
  }
18
18
 
19
19
  server.start_server(mounts: {file_metadatas: current_version_handler}) do |port|
20
- Puppet[:masterport] = port
20
+ Puppet[:serverport] = port
21
21
  expect {
22
22
  plugin.command_line.args << 'download'
23
23
  plugin.run
@@ -36,7 +36,7 @@ describe "puppet plugin" do
36
36
  }
37
37
 
38
38
  server.start_server(mounts: {file_metadatas: no_locales_handler}) do |port|
39
- Puppet[:masterport] = port
39
+ Puppet[:serverport] = port
40
40
  expect {
41
41
  plugin.command_line.args << 'download'
42
42
  plugin.run
@@ -59,7 +59,7 @@ describe "puppet plugin" do
59
59
 
60
60
  server.start_server(mounts: {file_metadatas: current_version_handler}) do |port|
61
61
  Puppet[:environment] = 'doesnotexistontheagent'
62
- Puppet[:masterport] = port
62
+ Puppet[:serverport] = port
63
63
  expect {
64
64
  plugin.command_line.args << 'download'
65
65
  plugin.run
@@ -60,6 +60,20 @@ describe Puppet::Configurer do
60
60
  expect(summary["time"]["last_run"]).to be_between(t1, t2)
61
61
  end
62
62
 
63
+ it "applies a cached catalog if pluginsync fails when usecacheonfailure is true" do
64
+ Puppet[:ignore_plugin_errors] = false
65
+
66
+ Puppet[:use_cached_catalog] = false
67
+ Puppet[:usecacheonfailure] = true
68
+
69
+ report = Puppet::Transaction::Report.new
70
+ expect_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate).and_raise(Puppet::Error, 'Failed to retrieve: some file')
71
+ expect(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(@catalog)
72
+
73
+ @configurer.run(pluginsync: true, report: report)
74
+ expect(report.cached_catalog_status).to eq('on_failure')
75
+ end
76
+
63
77
  describe 'resubmitting facts' do
64
78
  context 'when resubmit_facts is set to false' do
65
79
  it 'should not send data' do
@@ -23,6 +23,26 @@ describe "Puppet defaults" do
23
23
  end
24
24
  end
25
25
 
26
+ describe "when setting the :masterport" do
27
+ it "should also set :serverport to the same value" do
28
+ Puppet.settings[:masterport] = 3939
29
+ expect(Puppet.settings[:serverport]).to eq(3939)
30
+ end
31
+
32
+ it "should not overwrite :serverport if explicitly set" do
33
+ Puppet.settings[:serverport] = 9000
34
+ Puppet.settings[:masterport] = 9001
35
+ expect(Puppet.settings[:serverport]).to eq(9000)
36
+ end
37
+ end
38
+
39
+ describe "when setting the :serverport" do
40
+ it "should also set the :masterport to the same value" do
41
+ Puppet.settings[:serverport] = 9000
42
+ expect(Puppet.settings[:masterport]).to eq(9000)
43
+ end
44
+ end
45
+
26
46
  describe "when setting the :factpath" do
27
47
  it "should add the :factpath to Facter's search paths" do
28
48
  expect(Facter).to receive(:search).with("/my/fact/path")
@@ -149,13 +169,18 @@ describe "Puppet defaults" do
149
169
  expect(Puppet.settings[:report_server]).to eq("server")
150
170
  end
151
171
 
172
+ it "should use the default serverport value when report port is unspecified" do
173
+ Puppet.settings[:serverport] = "1234"
174
+ expect(Puppet.settings[:report_port]).to eq("1234")
175
+ end
176
+
152
177
  it "should use the default masterport value when report port is unspecified" do
153
178
  Puppet.settings[:masterport] = "1234"
154
179
  expect(Puppet.settings[:report_port]).to eq("1234")
155
180
  end
156
181
 
157
182
  it "should use report_port when set" do
158
- Puppet.settings[:masterport] = "1234"
183
+ Puppet.settings[:serverport] = "1234"
159
184
  Puppet.settings[:report_port] = "5678"
160
185
  expect(Puppet.settings[:report_port]).to eq("5678")
161
186
  end
@@ -33,8 +33,8 @@ describe Puppet::Util::Windows::ADSI::User,
33
33
 
34
34
  describe '.[]' do
35
35
  it 'should return string attributes as UTF-8' do
36
- administrator = Puppet::Util::Windows::ADSI::User.new('Administrator')
37
- expect(administrator['Description'].encoding).to eq(Encoding::UTF_8)
36
+ user = Puppet::Util::Windows::ADSI::User.new('Guest')
37
+ expect(user['Description'].encoding).to eq(Encoding::UTF_8)
38
38
  end
39
39
  end
40
40
 
@@ -187,6 +187,8 @@ shared_context 'types_setup' do
187
187
  result << Puppet::Pops::Types::PURIType
188
188
  result << Puppet::Pops::Types::PTupleType.new([tf.rich_data])
189
189
  result << Puppet::Pops::Types::PObjectType
190
+ result << Puppet::Pops::Types::PTypeType
191
+ result << Puppet::Pops::Types::PTypeSetType
190
192
  result
191
193
  end
192
194
  def rich_data_compatible_types
@@ -234,8 +234,8 @@ describe Puppet::Application::Doc do
234
234
  end
235
235
  end
236
236
 
237
- it "should operate in master run_mode" do
238
- expect(@doc.class.run_mode.name).to eq(:master)
237
+ it "should operate in server run_mode" do
238
+ expect(@doc.class.run_mode.name).to eq(:server)
239
239
 
240
240
  @doc.setup_rdoc
241
241
  end
@@ -3,7 +3,7 @@ require 'puppet/application/facts'
3
3
 
4
4
  describe Puppet::Application::Facts do
5
5
  let(:app) { Puppet::Application[:facts] }
6
- let(:values) { {"filesystems" => "apfs,autofs,devfs"} }
6
+ let(:values) { {"filesystems" => "apfs,autofs,devfs", "macaddress" => "64:52:11:22:03:25"} }
7
7
 
8
8
  before :each do
9
9
  Puppet::Node::Facts.indirection.terminus_class = :memory
@@ -21,6 +21,7 @@ describe Puppet::Application::Facts do
21
21
  name: whatever
22
22
  values:
23
23
  filesystems: apfs,autofs,devfs
24
+ macaddress: "64:52:11:22:03:25"
24
25
  END
25
26
 
26
27
  expect {
@@ -41,6 +42,7 @@ describe Puppet::Application::Facts do
41
42
  name: #{Puppet[:certname]}
42
43
  values:
43
44
  filesystems: apfs,autofs,devfs
45
+ macaddress: "64:52:11:22:03:25"
44
46
  END
45
47
 
46
48
  expect {
@@ -118,6 +118,11 @@ describe Puppet::Application do
118
118
  @appclass.run_mode :agent
119
119
  expect(@appclass.run_mode.name).to eq(:agent)
120
120
  end
121
+
122
+ it "considers :server to be master" do
123
+ @appclass.run_mode :server
124
+ expect(@appclass.run_mode).to be_master
125
+ end
121
126
  end
122
127
 
123
128
  describe ".environment_mode" do
@@ -147,7 +152,7 @@ describe Puppet::Application do
147
152
  describe "when dealing with run_mode" do
148
153
 
149
154
  class TestApp < Puppet::Application
150
- run_mode :master
155
+ run_mode :server
151
156
  def run_command
152
157
  # no-op
153
158
  end
@@ -159,16 +164,16 @@ describe Puppet::Application do
159
164
  app = TestApp.new
160
165
  app.initialize_app_defaults
161
166
 
162
- expect(Puppet.run_mode).to be_master
167
+ expect(Puppet.run_mode).to be_server
163
168
  end
164
169
 
165
170
  it "should sadly and frighteningly allow run_mode to change at runtime via #run" do
166
171
  app = TestApp.new
167
172
  app.run
168
173
 
169
- expect(app.class.run_mode.name).to eq(:master)
174
+ expect(app.class.run_mode.name).to eq(:server)
170
175
 
171
- expect(Puppet.run_mode).to be_master
176
+ expect(Puppet.run_mode).to be_server
172
177
  end
173
178
  end
174
179
 
@@ -104,6 +104,24 @@ describe Puppet::Configurer do
104
104
  expect(@logs).to include(an_object_having_attributes(level: :err, message: %r{Failed to apply catalog: Failed to retrieve pluginfacts: Could not retrieve information from environment production source\(s\) puppet:///pluginfacts}))
105
105
  end
106
106
 
107
+ it "applies a cached catalog if pluginsync fails when usecacheonfailure is true" do
108
+ Puppet[:ignore_plugin_errors] = false
109
+
110
+ Puppet[:use_cached_catalog] = false
111
+ Puppet[:usecacheonfailure] = true
112
+
113
+ body = "{\"message\":\"Not Found: Could not find environment 'fasdfad'\",\"issue_kind\":\"RUNTIME_ERROR\"}"
114
+ stub_request(:get, %r{/puppet/v3/file_metadatas/pluginfacts}).to_return(
115
+ status: 404, body: body, headers: {'Content-Type' => 'application/json'}
116
+ )
117
+ stub_request(:get, %r{/puppet/v3/file_metadata/pluginfacts}).to_return(
118
+ status: 404, body: body, headers: {'Content-Type' => 'application/json'}
119
+ )
120
+
121
+ expect(configurer.run(pluginsync: true, :report => report)).to eq(0)
122
+ expect(report.cached_catalog_status).to eq('on_failure')
123
+ end
124
+
107
125
  it "applies a cached catalog when it can't connect to the master" do
108
126
  error = Errno::ECONNREFUSED.new('Connection refused - connect(2)')
109
127
 
@@ -1026,30 +1044,45 @@ describe Puppet::Configurer do
1026
1044
  options = {}
1027
1045
  configurer.run(options)
1028
1046
  expect(options[:report].master_used).to eq('myserver:123')
1047
+ expect(options[:report].server_used).to eq('myserver:123')
1029
1048
  end
1030
1049
 
1031
- it "should report when a server is unavailable" do
1050
+ it "should report when usecacheonfailure is false and server is unavailable" do
1032
1051
  Puppet.settings[:server_list] = ["myserver:123"]
1052
+ Puppet[:usecacheonfailure] = false
1033
1053
 
1034
1054
  stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: [500, "Internal Server Error"])
1035
1055
 
1036
- allow(Puppet).to receive(:debug)
1037
- expect(Puppet).to receive(:debug).with("Puppet server myserver:123 is unavailable: 500 Internal Server Error")
1038
-
1039
1056
  expect {
1040
1057
  configurer.run
1041
- }.to raise_error(Puppet::Error, /Could not select a functional puppet master from server_list:/)
1058
+ }.to raise_error(Puppet::Error, /Could not select a functional puppet server from server_list:/)
1059
+
1060
+ expect(@logs).to include(an_object_having_attributes(level: :err, message: /Puppet server myserver:123 is unavailable: 500 Internal Server Error/))
1042
1061
  end
1043
1062
 
1044
1063
  it "should error when no servers in 'server_list' are reachable" do
1045
1064
  Puppet.settings[:server_list] = "myserver:123,someotherservername"
1065
+ Puppet[:usecacheonfailure] = false
1046
1066
 
1047
1067
  stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: 400)
1048
1068
  stub_request(:get, 'https://someotherservername:8140/status/v1/simple/master').to_return(status: 400)
1049
1069
 
1050
1070
  expect{
1051
1071
  configurer.run
1052
- }.to raise_error(Puppet::Error, /Could not select a functional puppet master from server_list: 'myserver:123,someotherservername'/)
1072
+ }.to raise_error(Puppet::Error, /Could not select a functional puppet server from server_list: 'myserver:123,someotherservername'/)
1073
+ end
1074
+
1075
+ it "should not error when usecacheonfailure is true and no servers in 'server_list' are reachable" do
1076
+ Puppet.settings[:server_list] = "myserver:123,someotherservername"
1077
+ Puppet[:usecacheonfailure] = true
1078
+
1079
+ stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: 400)
1080
+ stub_request(:get, 'https://someotherservername:8140/status/v1/simple/master').to_return(status: 400)
1081
+
1082
+ options = {}
1083
+
1084
+ expect(configurer.run(options)).to eq(0)
1085
+ expect(options[:report].server_used).to be_nil
1053
1086
  end
1054
1087
 
1055
1088
  it "should not make multiple node requests when the server is found" do