Skip to content

Commit bc5de2c

Browse files
authored
Merge pull request #7494 from joshcooper/ruby26_9650
(PUP-9650) ruby 2.6
2 parents 5154f39 + c4098a4 commit bc5de2c

File tree

7 files changed

+16
-6
lines changed

7 files changed

+16
-6
lines changed

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ matrix:
1919
- rvm: 2.5
2020
env: "CHECK=parallel:spec\\[2\\]"
2121

22+
- rvm: 2.6
23+
env: "CHECK=parallel:spec\\[2\\]"
24+
2225
- rvm: jruby-9.2.0.0
2326
jdk: openjdk8
2427
env:

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ matrix:
77

88
# Ruby versions under test
99
platform:
10+
- Ruby26-x64
1011
- Ruby25-x64
1112
- Ruby24-x64
1213
- Ruby23-x64

lib/puppet/indirector/request.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def set_uri_key(key)
272272
return
273273
end
274274

275-
@server = uri.host if uri.host
275+
@server = uri.host if uri.host && !uri.host.empty?
276276

277277
# If the URI class can look up the scheme, it will provide a port,
278278
# otherwise it will default to '0'.

lib/puppet/pops/types/p_uri_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def uri_to_hash(uri)
175175
result[SCHEME] = scheme
176176
end
177177
result[USERINFO] = uri.userinfo unless uri.userinfo.nil?
178-
result[HOST] = uri.host.downcase unless uri.host.nil?
178+
result[HOST] = uri.host.downcase unless uri.host.nil? || uri.host.empty?
179179
result[PORT] = uri.port.to_s unless uri.port.nil? || uri.port == 80 && 'http' == scheme || uri.port == 443 && 'https' == scheme
180180
result[PATH] = uri.path unless uri.path.nil? || uri.path.empty?
181181
result[QUERY] = uri.query unless uri.query.nil?

lib/puppet/type/file/source.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ def full_path
220220
end
221221

222222
def server?
223-
uri and uri.host
223+
uri && uri.host && !uri.host.empty?
224224
end
225225

226226
def server
227-
(uri and uri.host) or Puppet.settings[:server]
227+
server? ? uri.host : Puppet.settings[:server]
228228
end
229229

230230
def port

lib/puppet/util.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def uri_to_path(uri)
359359
path = URI.unescape(uri.path.encode(Encoding::UTF_8))
360360

361361
if Puppet::Util::Platform.windows? && uri.scheme == 'file'
362-
if uri.host
362+
if uri.host && !uri.host.empty?
363363
path = "//#{uri.host}" + path # UNC
364364
else
365365
path.sub!(/^\//, '')

spec/unit/pops/loaders/loaders_spec.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252

5353
# Loaders caches the puppet_system_loader, must reset between tests
5454

55+
before :each do
56+
allow(File).to receive(:read).and_call_original
57+
end
58+
5559
context 'when loading pp resource types using auto loading' do
5660
let(:pp_resources) { config_dir('pp_resources') }
5761
let(:environments) { Puppet::Environments::Directories.new(my_fixture_dir, []) }
@@ -455,7 +459,9 @@ def compile_and_get_notifications(code)
455459
end
456460

457461
it "a function with syntax error has helpful error message" do
458-
expect { loader.load_typed(typed_name(:function, 'func_with_syntax_error')) }.to raise_error(/syntax error, unexpected keyword_end/)
462+
expect {
463+
loader.load_typed(typed_name(:function, 'func_with_syntax_error'))
464+
}.to raise_error(/syntax error, unexpected (keyword_)?end/)
459465
end
460466
end
461467

0 commit comments

Comments
 (0)