diff --git a/lib/beaker-puppet/install_utils/puppet5.rb b/lib/beaker-puppet/install_utils/puppet5.rb index ef5d6c3..2c4ce7f 100644 --- a/lib/beaker-puppet/install_utils/puppet5.rb +++ b/lib/beaker-puppet/install_utils/puppet5.rb @@ -217,7 +217,12 @@ def install_from_build_data_url(project_name, sha_yaml_url, local_hosts = nil) install_targets.each do |host| artifact_url, repoconfig_url = host_urls(host, build_details, base_url) - if repoconfig_url.nil? + if host.platform.variant == 'ubuntu' && host.platform.version.to_f >= 24.04 + # install the specific artifact we built, not based on how its repos are configured + tmp_file = host.tmpfile('puppet-agent') + on(host, "curl -L --output #{tmp_file} #{artifact_url}") + host.install_local_package(tmp_file) + elsif repoconfig_url.nil? install_artifact_on(host, artifact_url, project_name) else install_repo_configs_on(host, repoconfig_url) diff --git a/spec/beaker-puppet/install_utils/puppet5_spec.rb b/spec/beaker-puppet/install_utils/puppet5_spec.rb index f042617..0324a60 100644 --- a/spec/beaker-puppet/install_utils/puppet5_spec.rb +++ b/spec/beaker-puppet/install_utils/puppet5_spec.rb @@ -12,7 +12,7 @@ def logger describe ClassMixedWithDSLInstallUtils do let(:hosts) do make_hosts({ pe_ver: '3.0', - platform: 'linux', + platform: Beaker::Platform.new('redhat-9-x86_64'), roles: ['agent'], type: 'foss', }, 4) end @@ -363,6 +363,23 @@ def run_shared_test_steps end.to raise_error(Beaker::DSL::Outcomes::FailTest, /project_name.*#{sha_yaml_url}/) end + it 'installs the artifact on newer Ubuntu hosts' do + artifact_url = 'https://builds.example.com/puppet-agent.deb' + project_name = 'fake_project_66' + allow(subject).to receive(:fetch_build_details) + allow(subject).to receive(:configure_type_defaults_on) + allow(subject).to receive(:host_urls) { [artifact_url, ''] } + + hosts = [make_host('host.example.com', platform: Beaker::Platform.new('ubuntu-24.04-x86_64'))] + allow(subject).to receive(:hosts).and_return(hosts) + hosts.each do |host| + allow(host).to receive(:tmpfile).and_return('/tmp/puppet-agent.GcHvLR') + allow(subject).to receive(:on).with(host, /^curl/) + expect(host).to receive(:install_local_package).with('/tmp/puppet-agent.GcHvLR') + end + subject.install_from_build_data_url(project_name, 'sha_yaml_url') + end + it 'runs host.install_package instead of #install_artifact_on if theres a repo_config' do repoconfig_url = 'pants/man/shoot/to/the/stars' project_name = 'fake_project_66'