Skip to content

Commit

Permalink
(maint) attempt to fix puppet_collection_for
Browse files Browse the repository at this point in the history
In PR #149 a call to deprecated method `get_puppet_collection`
was replaced with a call `puppet_collection_for`. Unfortunatelly, the new method
does not have the same behavior for puppet_agent package.

This PR attempts for fix the issue
  • Loading branch information
Ciprian Badescu committed Jan 5, 2021
1 parent 9e6a259 commit 387cde4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/beaker-puppet/install_utils/foss_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,8 @@ def install_puppet_agent_pe_promoted_repo_on( hosts, opts )
opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
opts[:copy_dir_external] ||= host.external_copy_base
opts[:puppet_collection] ||= puppet_collection_for(:puppet_agent, opts[:puppet_agent_version])
opts[:puppet_collection] = 'PC1' if opts[:puppet_collection] == 'pc1'

add_role(host, 'aio') #we are installing agent, so we want aio role
release_path = opts[:download_url]
variant, version, arch, codename = host['platform'].to_array
Expand Down
2 changes: 2 additions & 0 deletions lib/beaker-puppet/install_utils/puppet_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def puppet_collection_for(package, version)

return 'pc1' if x == pc1_x[package]

return 'pc1' if package == :puppet_agent && x > 4 && version_is_less(version, "5.5.4")

# A y version >= 99 indicates a pre-release version of the next x release
x += 1 if y >= 99
"puppet#{x}" if x > 4
Expand Down
6 changes: 3 additions & 3 deletions spec/beaker-puppet/install_utils/foss_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1424,10 +1424,10 @@ def test_fetch_http_file_no_ending_slash(platform)
subject.install_puppet_agent_pe_promoted_repo_on( host, opts )
end

it 'sets correct file paths for agent version 1.x.x' do
it 'sets correct file paths for agent version < 5.5.4' do
host['platform'] = platform
agentversion = '1.x.x'
collection = 'pc1'
agentversion = '5.3.3'
collection = 'PC1'
opts = { :puppet_agent_version => "#{agentversion}" , :pe_promoted_builds_url => "#{downloadurl}"}

expect(subject).to receive(:fetch_http_file).once.with(
Expand Down
6 changes: 4 additions & 2 deletions spec/beaker-puppet/install_utils/puppet_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ def logger
{
'1.10.14' => 'pc1',
'1.10.x' => 'pc1',
'5.3.1' => 'puppet5',
'5.3.x' => 'puppet5',
'5.3.1' => 'pc1',
'5.3.x' => 'pc1',
'5.5.3' => 'pc1',
'5.5.4' => 'puppet5',
'5.99.0' => 'puppet6',
'6.1.99-foo' => 'puppet6',
'6.99.99' => 'puppet7',
Expand Down

0 comments on commit 387cde4

Please sign in to comment.