Skip to content

Commit 2cd0dda

Browse files
authored
Merge pull request #259 from shubhamshinde360/PE-37704
(PE-37704) Allow for SLES-11 (Intel) builds to be installed in PE 2021.7.x for testing
2 parents 6f77430 + 16e247b commit 2cd0dda

2 files changed

Lines changed: 54 additions & 6 deletions

File tree

lib/beaker-pe/install/pe_utils.rb

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,24 @@ def fetch_pe_on_mac(host, opts)
325325
end
326326
end
327327

328+
# Determine the build package to download on a sles-11 (Intel) host, install that package onto the host.
329+
# Assumed file name format: puppet-agent-7.29.1.26.gf344eeefa-1.sles11.x86_64.rpm.
330+
# This method should be called after puppet is installed on the master since it relies on the master
331+
# telling it the puppet agent version to form the download URL.
332+
# @param [Host] host The sles-11 host to download and install the package on.
333+
# @param [Hash{Symbol=>Symbol, String}] opts The options
334+
# @api private
335+
def install_rpm_on_sles11_host(host, puppet_agent_ver, opts)
336+
# Since sles11 builds are not available in PE, download from agent-downloads.
337+
agent_downloads_url = "http://agent-downloads.delivery.puppetlabs.net/puppet-agent"
338+
master_aio_version = puppet_fact(master, 'aio_agent_build')
339+
stream = opts[:puppet_collection] || "puppet#{puppet_agent_ver[0]}"
340+
path = "#{agent_downloads_url}/#{puppet_agent_ver}/repos/sles/11/#{stream}/x86_64"
341+
filename = "puppet-agent-#{master_aio_version}-1.sles11.x86_64"
342+
extension = ".rpm"
343+
host.install_package_with_rpm("#{path}/#{filename}#{extension}")
344+
end
345+
328346
#Determine the PE package to download/upload on a windows host, download/upload that package onto the host.
329347
#Assumed file name format: puppet-enterprise-3.3.0-rc1-559-g97f0833.msi
330348
# @param [Host] host The windows host to download/upload and unpack PE onto
@@ -920,8 +938,12 @@ def generic_install hosts, opts = {}
920938
:puppet_collection => host[:puppet_collection] || opts[:puppet_collection],
921939
:pe_promoted_builds_url => host[:pe_promoted_builds_url] || opts[:pe_promoted_builds_url]
922940
}
923-
install_params.delete(:pe_promoted_builds_url) if install_params[:pe_promoted_builds_url].nil?
924-
install_puppet_agent_pe_promoted_repo_on(host, install_params)
941+
if host['platform'] =~ /sles-11/
942+
install_rpm_on_sles11_host(host, install_params[:puppet_agent_version], opts)
943+
else
944+
install_params.delete(:pe_promoted_builds_url) if install_params[:pe_promoted_builds_url].nil?
945+
install_puppet_agent_pe_promoted_repo_on(host, install_params)
946+
end
925947
# 1 since no certificate found and waitforcert disabled
926948
acceptable_exit_codes = [0, 1]
927949
acceptable_exit_codes << 2 if opts[:type] == :upgrade

spec/beaker-pe/install/pe_utils_spec.rb

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ def metadata
3030
let(:basic_hosts) { make_hosts( { :pe_ver => '3.0',
3131
:platform => 'linux',
3232
:roles => [ 'agent' ],
33-
:type => 'pe'}, 4 ) }
33+
:type => 'pe'}, 5 ) }
3434
let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
3535
basic_hosts[1][:platform] = 'windows'
3636
basic_hosts[2][:platform] = 'osx-10.9-x86_64'
3737
basic_hosts[3][:platform] = 'eos'
38+
basic_hosts[4][:platform] = 'sles'
3839
basic_hosts }
39-
let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
40+
let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3], hosts[4] ] }
4041
let(:winhost) { make_host( 'winhost', { :platform => 'windows',
4142
:pe_ver => '3.0',
4243
:type => 'pe',
@@ -55,7 +56,10 @@ def metadata
5556
:type => 'pe',
5657
:working_dir => '/tmp',
5758
:dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
58-
59+
let(:sles11host) { make_host( 'sles11', { :platform => 'sles',
60+
:pe_ver => '3.0',
61+
:type => 'pe',
62+
:working_dir => '/tmp'} ) }
5963
let(:lei_hosts) { make_hosts( { :pe_ver => '3.0',
6064
:platform => 'linux',
6165
:roles => [ 'agent' ],
@@ -1637,8 +1641,30 @@ def slice_installer_options(host)
16371641
subject.do_install([])
16381642
end
16391643

1644+
context "install rpm file in sles host" do
1645+
let(:opts) {
1646+
{ :puppet_collection => 'puppet7' }
1647+
}
1648+
let(:stream) { opts[:puppet_collection] }
1649+
let(:puppet_agent_ver) { '7.29.1.26' }
1650+
let(:agent_downloads_url) { "http://agent-downloads.delivery.puppetlabs.net/puppet-agent" }
1651+
let(:master_version) { '7.29.1.26.gf344eeefa' }
1652+
let(:path) { "#{agent_downloads_url}/#{puppet_agent_ver}/repos/sles/11/#{stream}/x86_64" }
1653+
let(:filename) { "puppet-agent-#{master_version}-1.sles11.x86_64" }
1654+
let(:extension) { '.rpm' }
1655+
let(:url) { "#{path}/#{filename}#{extension}" }
1656+
1657+
it "generates the correct url to download the package" do
1658+
allow( subject ).to receive( :puppet_fact ).and_return( master_version )
1659+
allow( subject ).to receive( :master ).and_return( {} )
1660+
1661+
expect( hosts[4] ).to receive( :install_package_with_rpm ).with( url ).once
1662+
subject.install_rpm_on_sles11_host(hosts[4], puppet_agent_ver, opts)
1663+
end
1664+
end
1665+
16401666
it 'can perform a simple installation' do
1641-
expect(subject).to receive(:get_mco_setting).and_return({})
1667+
expect(subject).to receive(:get_mco_setting).and_return({}).twice
16421668
allow( subject ).to receive( :verify_network_resources).with(hosts, nil)
16431669
allow( subject ).to receive( :on ).and_return( Beaker::Result.new( {}, '' ) )
16441670
allow( subject ).to receive( :fetch_pe ).and_return( true )

0 commit comments

Comments
 (0)