Skip to content

Commit 5e0d52b

Browse files
Update to use puppetcore puppet and facter
This change * Introduces a change to the Gemfile that enables a "switch" on PUPPET_AUTH_TOKEN environment variable. In other words, when not-set, then all gem dependencies will be resolved from https://rubygems.org. If set, then puppet and facter will be resolved from the https://rubygems-puppetcore.puppet.com This commit enables the peadm development team to test its functionality using the puppetcore puppet and facter gems. the Signed-off-by: Gavin Didrichsen <[email protected]>
1 parent 02407fe commit 5e0d52b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Gemfile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,21 @@ group :release_prep do
4949
gem "puppetlabs_spec_helper", '~> 6.0', require: false
5050
end
5151

52-
puppet_version = ENV['PUPPET_GEM_VERSION']
53-
facter_version = ENV['FACTER_GEM_VERSION']
54-
hiera_version = ENV['HIERA_GEM_VERSION']
55-
5652
gems = {}
53+
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
54+
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
55+
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
5756

58-
gems['puppet'] = location_for(puppet_version)
59-
60-
# If facter or hiera versions have been specified via the environment
61-
# variables
57+
# If PUPPET_AUTH_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
58+
# Otherwise, do as before and use location_for to fetch gems from the default source
59+
if !ENV['PUPPET_AUTH_TOKEN'].to_s.empty?
60+
gems['puppet'] = [puppet_version || '~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
61+
gems['facter'] = [facter_version || '~> 4.0', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
62+
else
63+
gems['puppet'] = location_for(puppet_version)
64+
gems['facter'] = location_for(facter_version) if facter_version
65+
end
6266

63-
gems['facter'] = location_for(facter_version) if facter_version
6467
gems['hiera'] = location_for(hiera_version) if hiera_version
6568

6669
gems.each do |gem_name, gem_params|

0 commit comments

Comments
 (0)