Skip to content

Commit 411e90d

Browse files
Merge pull request puppetlabs#335 from ekinanp/MODULES-7760
(MODULES-7760) Remove dist_tag in install.pp for RHEL platforms
2 parents 53af30e + a11902a commit 411e90d

File tree

3 files changed

+2
-133
lines changed

3 files changed

+2
-133
lines changed

manifests/install.pp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -161,47 +161,7 @@
161161
}
162162
}
163163
}
164-
} elsif ($::osfamily == 'RedHat') and ($package_version != 'present') {
165-
# Workaround PUP-5802/PUP-5025
166-
if ($::operatingsystem == 'Fedora') {
167-
if $pa_collection == 'PC1' or $pa_collection == 'puppet5' {
168-
# There's three cases here due to some mistakes with how we
169-
# set-up our distro tags for Fedora platforms:
170-
# * For newer Fedora platforms (e.g. Fedora 28), we want
171-
# to use the fc<major> tag
172-
#
173-
# * For older Fedora platforms (e.g. Fedora 26 and 27), we
174-
# have two separate cases:
175-
# * If the package version's > 5.5.3, then we use the fedora<major>
176-
# tag, b/c in those versions we removed the 'f' prefix.
177-
#
178-
# * If the package version's <= 5.5.3, then we use the fedoraf<major>
179-
# tag b/c the 'f' prefix is still there.
180-
#
181-
if (versioncmp("${::operatingsystemmajrelease}", '27') > 0) {
182-
$dist_tag = "fc${::operatingsystemmajrelease}"
183-
} elsif (versioncmp("${package_version}", '5.5.3') > 0) {
184-
$dist_tag = "fedora${::operatingsystemmajrelease}"
185-
} else {
186-
$dist_tag = "fedoraf${::operatingsystemmajrelease}"
187-
}
188-
} else {
189-
$dist_tag = "fc${::operatingsystemmajrelease}"
190-
}
191-
} elsif ($::platform_tag != undef and $::platform_tag =~ /redhatfips.*/) {
192-
# The undef check here is for unit tests that don't supply this fact.
193-
$dist_tag = 'redhatfips7'
194-
} elsif $::operatingsystem == 'Amazon' {
195-
$dist_tag = 'el6'
196-
} else {
197-
$dist_tag = "el${::operatingsystemmajrelease}"
198-
}
199-
package { $::puppet_agent::package_name:
200-
ensure => "${package_version}-1.${dist_tag}",
201-
install_options => $install_options,
202-
}
203164
} elsif ($::osfamily == 'Debian') and ($package_version != 'present') {
204-
# Workaround PUP-5802/PUP-5025
205165
package { $::puppet_agent::package_name:
206166
ensure => "${package_version}-1${::lsbdistcodename}",
207167
install_options => $install_options,

spec/classes/puppet_agent_osfamily_redhat_spec.rb

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -120,87 +120,6 @@
120120
end
121121
end
122122

123-
# There are a lot of special cases here, so it is best to have a separate
124-
# unit test context for them.
125-
context 'distro tag on Fedora platforms' do
126-
def sets_distro_tag_to(expected_distro_tag)
127-
is_expected.to contain_package('puppet-agent').with_ensure(
128-
"#{params[:package_version]}-1.#{expected_distro_tag}"
129-
)
130-
end
131-
132-
let(:facts) do
133-
super().merge(:operatingsystem => 'Fedora')
134-
end
135-
136-
context 'when the collection is PC1' do
137-
let(:params) do
138-
# Older agents use the PC1 collection, so set the package_version
139-
# to 1.10.9 to simulate this.
140-
super().merge(:collection => 'PC1', :package_version => '1.10.9')
141-
end
142-
143-
let(:facts) do
144-
# Older agents do not support anything past Fedora 27
145-
super().merge(:operatingsystemmajrelease => 27)
146-
end
147-
148-
it { sets_distro_tag_to('fedoraf27') }
149-
end
150-
151-
context 'when the collection is puppet5' do
152-
let(:params) do
153-
super().merge(:collection => 'puppet5')
154-
end
155-
156-
context 'on newer Fedora versions' do
157-
let(:facts) do
158-
super().merge(:operatingsystemmajrelease => 28)
159-
end
160-
161-
it { sets_distro_tag_to('fc28') }
162-
end
163-
164-
context 'on older Fedora versions' do
165-
let(:facts) do
166-
super().merge(:operatingsystemmajrelease => 27)
167-
end
168-
169-
shared_examples 'a package version' do |package_version, distro_tag|
170-
let(:params) do
171-
super().merge(:package_version => package_version)
172-
end
173-
174-
it { sets_distro_tag_to(distro_tag) }
175-
end
176-
177-
context 'when package_version > 5.5.3' do
178-
include_examples 'a package version', '5.5.4', 'fedora27'
179-
end
180-
181-
context 'when package_version == 5.5.3' do
182-
include_examples 'a package version', '5.5.3', 'fedoraf27'
183-
end
184-
185-
context 'when package_version < 5.5.3' do
186-
include_examples 'a package version', '5.5.1', 'fedoraf27'
187-
end
188-
end
189-
end
190-
191-
context 'when the collection is newer than PC1 and puppet5' do
192-
let(:params) do
193-
super().merge(:collection => 'puppet6', :package_version => '6.0.0')
194-
end
195-
196-
let(:facts) do
197-
super().merge(:operatingsystemmajrelease => 27)
198-
end
199-
200-
it { sets_distro_tag_to('fc27') }
201-
end
202-
end
203-
204123
[['RedHat', 'el-7-x86_64', 'el-7-x86_64', 7], ['Amazon', '', 'el-6-x64', 6]].each do |os, tag, repodir, osmajor|
205124
context "when PE on #{os}" do
206125
before(:each) do
@@ -290,7 +209,7 @@ def sets_distro_tag_to(expected_distro_tag)
290209
:package_version => package_version
291210
}
292211
}
293-
it { is_expected.to contain_package('puppet-agent').with_ensure("#{params[:package_version]}-1.el#{osmajor}") }
212+
it { is_expected.to contain_package('puppet-agent').with_ensure("#{params[:package_version]}") }
294213

295214
end
296215

spec/classes/puppet_agent_spec.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,7 @@ def global_facts(facts, os)
160160
it { is_expected.to contain_class('puppet_agent::prepare') }
161161
it { is_expected.to contain_class('puppet_agent::install').that_requires('Class[puppet_agent::prepare]') }
162162

163-
if facts[:osfamily] == 'RedHat'
164-
if facts[:operatingsystem] == 'Fedora'
165-
# Workaround PUP-5802/PUP-5025
166-
yum_package_version = package_version + '-1.fedoraf' + facts[:operatingsystemmajrelease]
167-
it { is_expected.to contain_package('puppet-agent').with_ensure(yum_package_version) }
168-
else
169-
yum_package_version = package_version + '-1.el' + facts[:operatingsystemmajrelease]
170-
it { is_expected.to contain_package('puppet-agent').with_ensure(yum_package_version) }
171-
end
172-
elsif facts[:osfamily] == 'Debian'
173-
# Workaround PUP-5802/PUP-5025
163+
if facts[:osfamily] == 'Debian'
174164
deb_package_version = package_version + '-1' + facts[:lsbdistcodename]
175165
it { is_expected.to contain_package('puppet-agent').with_ensure(deb_package_version) }
176166
elsif facts[:osfamily] == 'Solaris' && (facts[:operatingsystemmajrelease] == '10' || Puppet.version < '4.0.0')

0 commit comments

Comments
 (0)