Skip to content

Commit

Permalink
Merge pull request #257 from puppetlabs/install_repo
Browse files Browse the repository at this point in the history
Install puppet-agent directly on Ubuntu 24.04
  • Loading branch information
joshcooper authored May 31, 2024
2 parents a774be9 + 787bbdc commit 180ce91
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/beaker-puppet/install_utils/puppet5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion spec/beaker-puppet/install_utils/puppet5_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 180ce91

Please sign in to comment.