Skip to content

Commit 45dffbe

Browse files
committed
(PUP-9648) Remove special handling for puppetserver < 5
Puppetserver 5 and up accept and default to JSON instead of PSON so there's no reason anymore to check if the server supports it.
1 parent f6cba46 commit 45dffbe

File tree

3 files changed

+0
-42
lines changed

3 files changed

+0
-42
lines changed

lib/puppet/http/service/report.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ def put_report(name, report, environment:)
5454

5555
if response.success?
5656
response
57-
elsif !@session.supports?(:report, 'json') && Puppet[:preferred_serialization_format] != 'pson'
58-
#TRANSLATORS "pson", "preferred_serialization_format", and "puppetserver" should not be translated
59-
raise Puppet::HTTP::ProtocolError.new(_("To submit reports to a server running puppetserver %{server_version}, set preferred_serialization_format to pson") % { server_version: response[Puppet::HTTP::HEADER_PUPPET_VERSION]})
6057
else
6158
raise Puppet::HTTP::ResponseError.new(response)
6259
end

spec/unit/http/service/report_spec.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,5 @@
103103
expect(err.response.code).to eq(400)
104104
end
105105
end
106-
107-
it 'raises an error if unsuccessful, the server version is < 5, and the current serialization format is not pson' do
108-
Puppet[:preferred_serialization_format] = 'json'
109-
110-
stub_request(:put, url).to_return(status: [400, 'Bad Request'], headers: {'X-Puppet-Version' => '4.2.3' })
111-
112-
expect {
113-
subject.put_report('infinity', report, environment: environment)
114-
}.to raise_error do |err|
115-
expect(err).to be_an_instance_of(Puppet::HTTP::ProtocolError)
116-
expect(err.message).to eq('To submit reports to a server running puppetserver 4.2.3, set preferred_serialization_format to pson')
117-
end
118-
end
119106
end
120107
end

spec/unit/indirector/report/rest_spec.rb

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,4 @@ def report_response
5555

5656
expect(described_class.indirection.save(report)).to eq(["store"])
5757
end
58-
59-
describe "when the server major version is less than 5" do
60-
it "raises if the save fails and we're not using pson" do
61-
Puppet[:preferred_serialization_format] = "json"
62-
63-
stub_request(:put, uri)
64-
.to_return(status: 500,
65-
headers: { 'Content-Type' => 'text/pson', Puppet::HTTP::HEADER_PUPPET_VERSION => '4.10.1' })
66-
67-
expect {
68-
described_class.indirection.save(report)
69-
}.to raise_error(Puppet::Error, /To submit reports to a server running puppetserver 4.10.1, set preferred_serialization_format to pson/)
70-
end
71-
72-
it "raises with HTTP 500 if the save fails and we're already using pson", if: Puppet.features.pson? do
73-
Puppet[:preferred_serialization_format] = "pson"
74-
75-
stub_request(:put, uri)
76-
.to_return(status: 500,
77-
headers: { 'Content-Type' => 'text/pson', Puppet::HTTP::HEADER_PUPPET_VERSION => '4.10.1' })
78-
79-
expect {
80-
described_class.indirection.save(report)
81-
}.to raise_error(Net::HTTPError, /Error 500 on SERVER/)
82-
end
83-
end
8458
end

0 commit comments

Comments
 (0)