@@ -53,18 +53,21 @@ group :system_tests do
5353  gem  "voxpupuli-acceptance" ,       require : false 
5454end 
5555
56- puppet_version  =  ENV [ 'PUPPET_GEM_VERSION' ] 
57- facter_version  =  ENV [ 'FACTER_GEM_VERSION' ] 
58- hiera_version  =  ENV [ 'HIERA_GEM_VERSION' ] 
59- 
6056gems  =  { } 
57+ puppet_version  =  ENV . fetch ( 'PUPPET_GEM_VERSION' ,  nil ) 
58+ facter_version  =  ENV . fetch ( 'FACTER_GEM_VERSION' ,  nil ) 
59+ hiera_version  =  ENV . fetch ( 'HIERA_GEM_VERSION' ,  nil ) 
6160
62- gems [ 'puppet' ]  =  location_for ( puppet_version ) 
63- 
64- # If facter or hiera versions have been specified via the environment 
65- # variables 
61+ # If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet 
62+ # Otherwise, do as before and use location_for to fetch gems from the default source 
63+ if  !ENV [ 'PUPPET_FORGE_TOKEN' ] . to_s . empty? 
64+   gems [ 'puppet' ]  =  [ '~> 8.11' ,  {  require : false ,  source : 'https://rubygems-puppetcore.puppet.com'  } ] 
65+   gems [ 'facter' ]  =  [ '~> 4.11' ,  {  require : false ,  source : 'https://rubygems-puppetcore.puppet.com'  } ] 
66+ else 
67+   gems [ 'puppet' ]  =  location_for ( puppet_version ) 
68+   gems [ 'facter' ]  =  location_for ( facter_version )  if  facter_version 
69+ end 
6670
67- gems [ 'facter' ]  =  location_for ( facter_version )  if  facter_version 
6871gems [ 'hiera' ]  =  location_for ( hiera_version )  if  hiera_version 
6972
7073gems . each  do  |gem_name ,  gem_params |
0 commit comments