Skip to content

Commit b98e693

Browse files
(maint) Merge up fd1cb18 to master
Generated by CI * commit 'fd1cb18fadfe7a967567606306e6aa270af4bed6': (packaging) Updating manpage file for 5.5.x Revert "Merge pull request #7401 from joshcooper/certmismatch_8213" (packaging) Updating manpage file for 6.0.x (packaging) Updating the puppet.pot file (maint) Remove unnecessary condition (PUP-9357) Redact checks if sensitive (packaging) Updating the puppet.pot file (maint) Enable windows tests (PUP-8213) Display correct message when certname is mismatched (packaging) Updating the puppet.pot file (PUP-9076) Do not push nil on server context (maint) modify test to regex, rather than exact (maint) Clarify error on Timeout::Error exception
2 parents 5c155be + fd1cb18 commit b98e693

25 files changed

+75
-57
lines changed

lib/puppet/configurer.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ def run(options = {})
226226
# mode. We shouldn't try to do any failover in that case.
227227
if options[:catalog].nil? && do_failover
228228
server, port = find_functional_server
229+
if server.nil?
230+
raise Puppet::Error, _("Could not select a functional puppet master from server_list: '%{server_list}'") % { server_list: Puppet[:server_list] }
231+
else
232+
Puppet.debug _("Selected puppet server: %{server}:%{port}") % { server: server, port: port }
233+
report.master_used = "#{server}:#{port}"
234+
end
229235
Puppet.override(server: server, serverport: port) do
230-
if server
231-
Puppet.debug _("Selected puppet server: %{server}:%{port}") % { server: server, port: port }
232-
report.master_used = "#{server}:#{port}"
233-
else
234-
Puppet.warning _("Could not select a functional puppet server")
235-
end
236236
completed = run_internal(options)
237237
end
238238
else

lib/puppet/network/http/connection.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,22 @@ def apply_options_to(request, options)
298298
def execute_request(connection, request)
299299
start = Time.now
300300
connection.request(request)
301-
rescue EOFError => e
301+
rescue => exception
302302
elapsed = (Time.now - start).to_f.round(3)
303-
uri = @site.addr + request.path.split('?')[0]
304-
eof = EOFError.new(_('request %{uri} interrupted after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
305-
eof.set_backtrace(e.backtrace) unless e.backtrace.empty?
306-
raise eof
303+
uri = [@site.addr, request.path.split('?')[0]].join('/')
304+
eclass = exception.class
305+
306+
err = case exception
307+
when EOFError
308+
eclass.new(_('request %{uri} interrupted after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
309+
when Timeout::Error
310+
eclass.new(_('request %{uri} timed out after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
311+
else
312+
eclass.new(_('request %{uri} failed: %{msg}') % {uri: uri, msg: exception.message})
313+
end
314+
315+
err.set_backtrace(exception.backtrace) unless exception.backtrace.empty?
316+
raise err
307317
end
308318

309319
def with_connection(site, &block)

lib/puppet/type/exec.rb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -622,18 +622,26 @@ def current_username
622622

623623
private
624624
def set_sensitive_parameters(sensitive_parameters)
625-
# Respect sensitive commands
626-
set_one_sensitive_parameter(:command, sensitive_parameters)
627-
set_one_sensitive_parameter(:unless, sensitive_parameters)
628-
set_one_sensitive_parameter(:onlyif, sensitive_parameters)
629-
super(sensitive_parameters)
630-
end
625+
# If any are sensitive, mark all as sensitive
626+
sensitive = false
627+
parameters_to_check = [:command, :unless, :onlyif]
628+
629+
parameters_to_check.each do |p|
630+
if sensitive_parameters.include?(p)
631+
sensitive_parameters.delete(p)
632+
sensitive = true
633+
end
634+
end
631635

632-
def set_one_sensitive_parameter(parameter, sensitive_parameters)
633-
if sensitive_parameters.include?(parameter)
634-
sensitive_parameters.delete(parameter)
635-
parameter(parameter).sensitive = true
636+
if sensitive
637+
parameters_to_check.each do |p|
638+
if parameters.include?(p)
639+
parameter(p).sensitive = true
640+
end
641+
end
636642
end
643+
644+
super(sensitive_parameters)
637645
end
638646
end
639647
end

man/man8/puppet-catalog.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-CATALOG" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-CATALOG" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.

man/man8/puppet-config.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-CONFIG" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-CONFIG" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-config\fR \- Interact with Puppet\'s settings\.

man/man8/puppet-describe.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-DESCRIBE" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-DESCRIBE" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-describe\fR \- Display help about resource types

man/man8/puppet-doc.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-DOC" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-DOC" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-doc\fR \- Generate Puppet references

man/man8/puppet-epp.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-EPP" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-EPP" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.

man/man8/puppet-facts.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-FACTS" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-FACTS" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-facts\fR \- Retrieve and store facts\.

man/man8/puppet-filebucket.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-FILEBUCKET" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-FILEBUCKET" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket

man/man8/puppet-generate.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-GENERATE" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-GENERATE" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.

man/man8/puppet-help.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-HELP" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-HELP" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-help\fR \- Display Puppet help\.

man/man8/puppet-key.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-KEY" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-KEY" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-key\fR \- Create, save, and remove certificate keys\.

man/man8/puppet-man.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-MAN" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-MAN" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-man\fR \- Display Puppet manual pages\.

man/man8/puppet-module.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-MODULE" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-MODULE" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.

man/man8/puppet-node.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-NODE" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-NODE" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-node\fR \- View and manage node definitions\.

man/man8/puppet-parser.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-PARSER" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-PARSER" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-parser\fR \- Interact directly with the parser\.

man/man8/puppet-plugin.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-PLUGIN" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-PLUGIN" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.

man/man8/puppet-report.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-REPORT" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-REPORT" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-report\fR \- Create, display, and submit reports\.

man/man8/puppet-resource.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-RESOURCE" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-RESOURCE" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-resource\fR \- The resource abstraction layer shell

man/man8/puppet-ssl.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-SSL" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-SSL" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients

man/man8/puppet-status.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-STATUS" "8" "February 2019" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-STATUS" "8" "March 2019" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-status\fR \- View puppet server status\.

spec/unit/configurer_spec.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,26 +1034,25 @@ def expects_neither_new_or_cached_catalog
10341034
Puppet.settings[:server_list] = ["myserver:123"]
10351035
response = Net::HTTPInternalServerError.new(nil, 500, 'Internal Server Error')
10361036
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: response))
1037-
@agent.stubs(:run_internal)
10381037

10391038
Puppet.expects(:debug).with("Puppet server myserver:123 is unavailable: 500 Internal Server Error")
1040-
@agent.run
1039+
expect{ @agent.run }.to raise_error(Puppet::Error, /Could not select a functional puppet master from server_list/)
10411040
end
10421041

1043-
it "should fallback to an empty server when failover fails" do
1042+
it "should error when no servers in 'server_list' are reachable" do
10441043
Puppet.settings[:server_list] = ["myserver:123"]
10451044
error = Net::HTTPError.new(400, 'dummy server communication error')
1046-
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(error)
1047-
@agent.stubs(:run_internal)
1045+
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: error))
10481046

10491047
options = {}
1050-
@agent.run(options)
1048+
expect{ @agent.run(options) }.to raise_error(Puppet::Error, /Could not select a functional puppet master from server_list/)
10511049
expect(options[:report].master_used).to be_nil
10521050
end
10531051

10541052
it "should not make multiple node requets when the server is found" do
10551053
Puppet.settings[:server_list] = ["myserver:123"]
1056-
Puppet::Network::HttpPool.expects(:http_ssl_instance).once
1054+
response = Net::HTTPOK.new(nil, 200, 'OK')
1055+
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: response))
10571056
@agent.stubs(:run_internal)
10581057

10591058
@agent.run

spec/unit/network/http/connection_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
expect do
8888
connection.get('request')
89-
end.to raise_error(Puppet::Error, "certificate verify failed: [shady looking signature]")
89+
end.to raise_error(Puppet::Error, /certificate verify failed: \[shady looking signature\]/)
9090
end
9191

9292
it "should provide a helpful error message when hostname was not match with server certificate", :unless => Puppet::Util::Platform.windows? || RUBY_PLATFORM == 'java' do

spec/unit/type/exec_spec.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ def exec_stub(options = {})
4646
dummy = Puppet::Type.type(:exec).new(:name => @command)
4747
dummy.provider.class.any_instance.stubs(:validatecmd)
4848
dummy.provider.class.any_instance.stubs(:checkexe).returns(true)
49-
pass_status = stub('status', :exitstatus => 0)
50-
fail_status = stub('status', :exitstatus => 1)
51-
dummy.provider.class.any_instance.stubs(:run).with(:true, true).returns(['test output pass', pass_status])
52-
dummy.provider.class.any_instance.stubs(:run).with(:false, true).returns(['test output fail', fail_status])
49+
pass_status = stub('status', :exitstatus => 0, :split => ["pass output"])
50+
fail_status = stub('status', :exitstatus => 1, :split => ["fail output"])
51+
Puppet::Util::Execution.stubs(:execute).with(:true, anything).returns(pass_status)
52+
Puppet::Util::Execution.stubs(:execute).with(:false, anything).returns(fail_status)
5353

5454
test = Puppet::Type.type(:exec).new(type_args)
5555

@@ -212,12 +212,13 @@ def exec_stub(options = {})
212212
expect(@logs).to include(an_object_having_attributes(level: :debug, message: output))
213213
end
214214

215-
it "should log a message with a redacted command if command or #{check} is sensitive" do
216-
output = "'[command redacted]' won't be executed because of failed check '#{check}'"
217-
test = exec_stub({:command => @command, check => result, :sensitive_parameters => [:command, check]})
215+
it "should log a message with a redacted command and check if #{check} is sensitive" do
216+
output1 = "Executing check '[redacted]'"
217+
output2 = "'[command redacted]' won't be executed because of failed check '#{check}'"
218+
test = exec_stub({:command => @command, check => result, :sensitive_parameters => [check]})
218219
expect(test.check_all_attributes).to eq(false)
219-
220-
expect(@logs).to include(an_object_having_attributes(level: :debug, message: output))
220+
expect(@logs).to include(an_object_having_attributes(level: :debug, message: output1))
221+
expect(@logs).to include(an_object_having_attributes(level: :debug, message: output2))
221222
end
222223
end
223224
end

0 commit comments

Comments
 (0)