Skip to content

Commit

Permalink
(maint) Fix osfamily::darwin OSX version regex
Browse files Browse the repository at this point in the history
The previous regex used a character class instead of a union to
match the major Mac OSX product version, which would match values
such as "10.14", "10.15". This meant that the puppet_agent module
would think these are supported platforms, and proceed further with
the installation (failing at a different point, which would produce
a harder-to-read error message). This commit fixes things so that
non-supported Mac OSX platforms correctly fail in the osfamily::darwin
class with a readable error message.
  • Loading branch information
ekinanp committed Feb 28, 2018
1 parent b71d946 commit 3e5d825
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifests/osfamily/darwin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
) {
assert_private()

if $::macosx_productversion_major !~ '10\.[9,10,11]' {
if $::macosx_productversion_major !~ /^10\.(9|10|11|12|13)/ {
fail("${::macosx_productname} ${::maxosx_productversion_major} not supported")
}

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_agent_osfamily_darwin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

describe 'supported environment' do
context "when running a supported OSX" do
["osx-10.9-x86_64", "osx-10.10-x86_64", "osx-10.11-x86_64"].each do |tag|
["osx-10.9-x86_64", "osx-10.10-x86_64", "osx-10.11-x86_64", "osx-10.12-x86_64", "osx-10.13-x86_64"].each do |tag|
context "on #{tag} with no aio_version" do
let(:osmajor) { tag.split('-')[1] }

Expand Down

0 comments on commit 3e5d825

Please sign in to comment.