File tree Expand file tree Collapse file tree 3 files changed +35
-5
lines changed Expand file tree Collapse file tree 3 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ cache: bundler
55before_install :
66 - bundle -v
77 - rm -f Gemfile.lock
8- - gem update --system $RUBYGEMS_VERSION
8+ - yes | gem update --system $RUBYGEMS_VERSION
99 - gem --version
1010 - bundle -v
1111script :
Original file line number Diff line number Diff line change 304304
305305 newproperty ( :proxy ) do
306306 desc "URL of a proxy server that Yum should use when accessing this repository.
307- This attribute can also be set to ` '_none_'`, which will make Yum bypass any
308- global proxy settings when accessing this repository.
307+ This attribute can also be set to '_none_' (or '' for EL >= 8 only),
308+ which will make Yum bypass any global proxy settings when accessing this repository.
309309 #{ ABSENT_DOC } "
310310
311311 newvalues ( %r{.*} , :absent )
312312 validate do |value |
313313 next if value . to_s =~ %r{^(absent|_none_)$}
314- parsed = URI . parse ( value )
314+ next if value . to_s . empty? && Facter . value ( :operatingsystemmajrelease ) . to_i >= 8
315315
316+ parsed = URI . parse ( value )
316317 unless VALID_SCHEMES . include? ( parsed . scheme )
317318 raise _ ( 'Must be a valid URL' )
318319 end
319320 end
321+
322+ munge do |value |
323+ return '' if Facter . value ( :operatingsystemmajrelease ) . to_i >= 8 && value . to_s == '_none_'
324+ value . to_s
325+ end
320326 end
321327
322328 newproperty ( :proxy_username ) do
Original file line number Diff line number Diff line change 312312
313313 describe 'proxy' do
314314 it_behaves_like 'a yumrepo parameter that can be absent' , :proxy
315+ it_behaves_like 'a yumrepo parameter that accepts a single URL' , :proxy
316+
315317 it 'accepts _none_' do
316318 described_class . new (
317319 name : 'puppetlabs' ,
318320 proxy : '_none_' ,
319321 )
320322 end
321- it_behaves_like 'a yumrepo parameter that accepts a single URL' , :proxy
323+
324+ it 'accepts an empty string' do
325+ described_class . new (
326+ name : 'puppetlabs' ,
327+ proxy : '' ,
328+ )
329+ end
330+
331+ it "munges '_none_' to empty string for EL >= 8" do
332+ Facter . stubs ( :value ) . with ( :operatingsystemmajrelease ) . returns ( '8' )
333+ instance = described_class . new ( name : 'puppetlabs' , proxy : '_none_' )
334+ expect ( instance [ :proxy ] ) . to eq ''
335+ end
336+
337+ it "does not munges '_none_' to empty string for EL < 8" do
338+ Facter . stubs ( :value ) . with ( :operatingsystemmajrelease ) . returns ( '7' )
339+ instance = described_class . new ( name : 'puppetlabs' , proxy : '_none_' )
340+ expect ( instance [ :proxy ] ) . to eq '_none_'
341+ end
342+
343+ it 'does not raise any errors' do
344+ expect { described_class . new ( name : 'puppetlabs' , proxy : '' ) } . not_to raise_error
345+ end
322346 end
323347
324348 describe 'proxy_username' do
You can’t perform that action at this time.
0 commit comments