diff --git a/lib/beaker-pe/install/pe_utils.rb b/lib/beaker-pe/install/pe_utils.rb index fd2f1eb..370f568 100644 --- a/lib/beaker-pe/install/pe_utils.rb +++ b/lib/beaker-pe/install/pe_utils.rb @@ -325,6 +325,24 @@ def fetch_pe_on_mac(host, opts) end end + # Determine the build package to download on a sles-11 (Intel) host, install that package onto the host. + # Assumed file name format: puppet-agent-7.29.1.26.gf344eeefa-1.sles11.x86_64.rpm. + # This method should be called after puppet is installed on the master since it relies on the master + # telling it the puppet agent version to form the download URL. + # @param [Host] host The sles-11 host to download and install the package on. + # @param [Hash{Symbol=>Symbol, String}] opts The options + # @api private + def install_rpm_on_sles11_host(host, puppet_agent_ver, opts) + # Since sles11 builds are not available in PE, download from agent-downloads. + agent_downloads_url = "http://agent-downloads.delivery.puppetlabs.net/puppet-agent" + master_aio_version = puppet_fact(master, 'aio_agent_build') + stream = opts[:puppet_collection] || "puppet#{puppet_agent_ver[0]}" + path = "#{agent_downloads_url}/#{puppet_agent_ver}/repos/sles/11/#{stream}/x86_64" + filename = "puppet-agent-#{master_aio_version}-1.sles11.x86_64" + extension = ".rpm" + host.install_package_with_rpm("#{path}/#{filename}#{extension}") + end + #Determine the PE package to download/upload on a windows host, download/upload that package onto the host. #Assumed file name format: puppet-enterprise-3.3.0-rc1-559-g97f0833.msi # @param [Host] host The windows host to download/upload and unpack PE onto @@ -920,8 +938,12 @@ def generic_install hosts, opts = {} :puppet_collection => host[:puppet_collection] || opts[:puppet_collection], :pe_promoted_builds_url => host[:pe_promoted_builds_url] || opts[:pe_promoted_builds_url] } - install_params.delete(:pe_promoted_builds_url) if install_params[:pe_promoted_builds_url].nil? - install_puppet_agent_pe_promoted_repo_on(host, install_params) + if host['platform'] =~ /sles-11/ + install_rpm_on_sles11_host(host, install_params[:puppet_agent_version], opts) + else + install_params.delete(:pe_promoted_builds_url) if install_params[:pe_promoted_builds_url].nil? + install_puppet_agent_pe_promoted_repo_on(host, install_params) + end # 1 since no certificate found and waitforcert disabled acceptable_exit_codes = [0, 1] acceptable_exit_codes << 2 if opts[:type] == :upgrade diff --git a/spec/beaker-pe/install/pe_utils_spec.rb b/spec/beaker-pe/install/pe_utils_spec.rb index 2871553..370d0d2 100644 --- a/spec/beaker-pe/install/pe_utils_spec.rb +++ b/spec/beaker-pe/install/pe_utils_spec.rb @@ -30,13 +30,14 @@ def metadata let(:basic_hosts) { make_hosts( { :pe_ver => '3.0', :platform => 'linux', :roles => [ 'agent' ], - :type => 'pe'}, 4 ) } + :type => 'pe'}, 5 ) } let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard'] basic_hosts[1][:platform] = 'windows' basic_hosts[2][:platform] = 'osx-10.9-x86_64' basic_hosts[3][:platform] = 'eos' + basic_hosts[4][:platform] = 'sles' basic_hosts } - let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] } + let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3], hosts[4] ] } let(:winhost) { make_host( 'winhost', { :platform => 'windows', :pe_ver => '3.0', :type => 'pe', @@ -55,7 +56,10 @@ def metadata :type => 'pe', :working_dir => '/tmp', :dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) } - + let(:sles11host) { make_host( 'sles11', { :platform => 'sles', + :pe_ver => '3.0', + :type => 'pe', + :working_dir => '/tmp'} ) } let(:lei_hosts) { make_hosts( { :pe_ver => '3.0', :platform => 'linux', :roles => [ 'agent' ], @@ -1637,8 +1641,30 @@ def slice_installer_options(host) subject.do_install([]) end + context "install rpm file in sles host" do + let(:opts) { + { :puppet_collection => 'puppet7' } + } + let(:stream) { opts[:puppet_collection] } + let(:puppet_agent_ver) { '7.29.1.26' } + let(:agent_downloads_url) { "http://agent-downloads.delivery.puppetlabs.net/puppet-agent" } + let(:master_version) { '7.29.1.26.gf344eeefa' } + let(:path) { "#{agent_downloads_url}/#{puppet_agent_ver}/repos/sles/11/#{stream}/x86_64" } + let(:filename) { "puppet-agent-#{master_version}-1.sles11.x86_64" } + let(:extension) { '.rpm' } + let(:url) { "#{path}/#{filename}#{extension}" } + + it "generates the correct url to download the package" do + allow( subject ).to receive( :puppet_fact ).and_return( master_version ) + allow( subject ).to receive( :master ).and_return( {} ) + + expect( hosts[4] ).to receive( :install_package_with_rpm ).with( url ).once + subject.install_rpm_on_sles11_host(hosts[4], puppet_agent_ver, opts) + end + end + it 'can perform a simple installation' do - expect(subject).to receive(:get_mco_setting).and_return({}) + expect(subject).to receive(:get_mco_setting).and_return({}).twice allow( subject ).to receive( :verify_network_resources).with(hosts, nil) allow( subject ).to receive( :on ).and_return( Beaker::Result.new( {}, '' ) ) allow( subject ).to receive( :fetch_pe ).and_return( true )