Skip to content

Commit 318dcfa

Browse files
committed
(MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat
`Puppet.version.to_f` on Puppet 4.10.0 will evaluate to `4.1`, causing test and behavioural changes when conditionals check that the version is equal or greater than versions such as `4.3`. Version comparisons that are vulnerable to this have been changed to use Puppet's versioncmp implementation, while most others only check for for major version boundaries which is safe.
1 parent e4ea1c4 commit 318dcfa

19 files changed

+19
-19
lines changed

spec/aliases/absolute_path_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::absolute_path', type: :class do
55
describe 'valid paths handling' do
66
%w{

spec/aliases/absolutepath_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::absolutepath', type: :class do
55
describe 'valid handling' do
66
%w{

spec/aliases/array_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::array', type: :class do
55
describe 'accepts arrays' do
66
[

spec/aliases/bool_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::bool', type: :class do
55
describe 'accepts booleans' do
66
[

spec/aliases/float_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::float', type: :class do
55
describe 'accepts floats' do
66
[

spec/aliases/hash_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::hash', type: :class do
55
describe 'accepts hashes' do
66
[

spec/aliases/httpsurl_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::httpsurl', type: :class do
55
describe 'valid handling' do
66
%w{

spec/aliases/httpurl_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::httpurl', type: :class do
55
describe 'valid handling' do
66
%w{

spec/aliases/integer_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::integer', type: :class do
55
describe 'accepts integers' do
66
[

spec/aliases/ip_address.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
if Puppet.version.to_f >= 4.5
3+
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
44
describe 'test::ip_address', type: :class do
55
describe 'accepts ipv4 and ipv6 addresses' do
66
[

0 commit comments

Comments
 (0)