@@ -46,18 +46,21 @@ group :system_tests do
4646 gem "voxpupuli-acceptance" , require : false
4747end
4848
49- puppet_version = ENV [ 'PUPPET_GEM_VERSION' ]
50- facter_version = ENV [ 'FACTER_GEM_VERSION' ]
51- hiera_version = ENV [ 'HIERA_GEM_VERSION' ]
52-
5349gems = { }
50+ puppet_version = ENV . fetch ( 'PUPPET_GEM_VERSION' , nil )
51+ facter_version = ENV . fetch ( 'FACTER_GEM_VERSION' , nil )
52+ hiera_version = ENV . fetch ( 'HIERA_GEM_VERSION' , nil )
5453
55- gems [ 'puppet' ] = location_for ( puppet_version )
56-
57- # If facter or hiera versions have been specified via the environment
58- # variables
54+ # If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
55+ # Otherwise, do as before and use location_for to fetch gems from the default source
56+ if !ENV [ 'PUPPET_FORGE_TOKEN' ] . to_s . empty?
57+ gems [ 'puppet' ] = [ '~> 8.11' , { require : false , source : 'https://rubygems-puppetcore.puppet.com' } ]
58+ gems [ 'facter' ] = [ '~> 4.11' , { require : false , source : 'https://rubygems-puppetcore.puppet.com' } ]
59+ else
60+ gems [ 'puppet' ] = location_for ( puppet_version )
61+ gems [ 'facter' ] = location_for ( facter_version ) if facter_version
62+ end
5963
60- gems [ 'facter' ] = location_for ( facter_version ) if facter_version
6164gems [ 'hiera' ] = location_for ( hiera_version ) if hiera_version
6265
6366gems . each do |gem_name , gem_params |
0 commit comments