14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.8.0] - 2021-06-22

### Summary
Add Fedora 34 support to module. Add macOS 11 support to `install` task. Fix `facts_diff` task argument parsing on Windows.

### Features

- ([MODULES-11085](https://tickets.puppetlabs.com/browse/MODULES-11085)) Add Fedora 34 support to module ([#564](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/564))
- ([PE-31118](https://tickets.puppetlabs.com/browse/PE-31118)) Add macOS 11 support to `install` task ([#560](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/560))

### Bug fixes

- ([MODULES-11074](https://tickets.puppetlabs.com/browse/MODULES-11074)) Fix `facts_diff` task argument parsing on Windows ([#561](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/561))

## [4.7.0] - 2021-05-12

### Summary
Expand Down
15 changes: 11 additions & 4 deletions manifests/osfamily/darwin.pp
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
class puppet_agent::osfamily::darwin{
assert_private()

if $::macosx_productversion_major =~ /^10\./ {
$productversion_major = $::macosx_productversion_major
} else {
$productversion_array = split($::macosx_productversion_major, '[.]')
$productversion_major = $productversion_array[0]
}

if $::puppet_agent::absolute_source {
$source = $::puppet_agent::absolute_source
} elsif ($::puppet_agent::is_pe and (!$::puppet_agent::use_alternate_sources)) {
$pe_server_version = pe_build_version()
if $::puppet_agent::alternate_pe_source {
$source = "${::puppet_agent::alternate_pe_source}/packages/${pe_server_version}/${::platform_tag}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$::macosx_productversion_major}.dmg"
$source = "${::puppet_agent::alternate_pe_source}/packages/${pe_server_version}/${::platform_tag}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
} elsif $::puppet_agent::source {
$source = "${::puppet_agent::source}/packages/${pe_server_version}/${::platform_tag}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$::macosx_productversion_major}.dmg"
$source = "${::puppet_agent::source}/packages/${pe_server_version}/${::platform_tag}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
} else {
$source = "puppet:///pe_packages/${pe_server_version}/${::platform_tag}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$::macosx_productversion_major}.dmg"
$source = "puppet:///pe_packages/${pe_server_version}/${::platform_tag}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
}
} else {
$source = "${::puppet_agent::mac_source}/mac/${::puppet_agent::collection}/${::macosx_productversion_major}/${::puppet_agent::arch}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$::macosx_productversion_major}.dmg"
$source = "${::puppet_agent::mac_source}/mac/${::puppet_agent::collection}/${::macosx_productversion_major}/${::puppet_agent::arch}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
}

class { '::puppet_agent::prepare::package':
Expand Down
8 changes: 5 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-puppet_agent",
"version": "4.7.0",
"version": "4.8.0",
"author": "puppetlabs",
"summary": "Upgrades All-In-One Puppet Agents",
"license": "Apache-2.0",
Expand Down Expand Up @@ -74,7 +74,8 @@
"29",
"30",
"31",
"32"
"32",
"34"
]
},
{
Expand Down Expand Up @@ -110,7 +111,8 @@
"operatingsystem": "OSX",
"operatingsystemrelease": [
"10.14",
"10.15"
"10.15",
"11"
]
}
],
Expand Down
37 changes: 36 additions & 1 deletion spec/classes/puppet_agent_osfamily_darwin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
describe 'supported environment' do
let(:params) {{ package_version: package_version }}
context "when running a supported OSX" do
["osx-10.12-x86_64", "osx-10.13-x86_64", "osx-10.14-x86_64", "osx-10.15-x86_64"].each do |tag|
["osx-10.12-x86_64", "osx-10.13-x86_64", "osx-10.14-x86_64", "osx-10.15-x86_64", "osx-11-x86_64"].each do |tag|
context "on #{tag} with no aio_version" do
let(:osmajor) { tag.split('-')[1] }

Expand Down Expand Up @@ -104,4 +104,39 @@
it { is_expected.to contain_file("/opt/puppetlabs/packages/puppet-agent-5.10.200-1.osx10.13.dmg").with_source('puppet:///pe_packages/2000.0.0/osx-10.13-x86_64/puppet-agent-5.10.200-1.osx10.13.dmg') }
end

describe 'when using package_version auto with MacOS 11(two numbers version productversion)' do
let(:params) {
{
package_version: 'auto',
}
}
let(:facts) do
facts.merge({
:is_pe => true,
:aio_agent_version => '1.10.99',
:platform_tag => 'osx-11-x86_64',
:macosx_productversion_major => '11.2',
:serverversion => '5.10.200'
})
end
it { is_expected.to contain_file("/opt/puppetlabs/packages/puppet-agent-5.10.200-1.osx11.dmg").with_source('puppet:///pe_packages/2000.0.0/osx-11-x86_64/puppet-agent-5.10.200-1.osx11.dmg') }
end

describe 'when using package_version auto with MacOS 11(one number version productversion)' do
let(:params) {
{
package_version: 'auto',
}
}
let(:facts) do
facts.merge({
:is_pe => true,
:aio_agent_version => '1.10.99',
:platform_tag => 'osx-11-x86_64',
:macosx_productversion_major => '11',
:serverversion => '5.10.200'
})
end
it { is_expected.to contain_file("/opt/puppetlabs/packages/puppet-agent-5.10.200-1.osx11.dmg").with_source('puppet:///pe_packages/2000.0.0/osx-11-x86_64/puppet-agent-5.10.200-1.osx11.dmg') }
end
end
2 changes: 1 addition & 1 deletion spec/classes/puppet_agent_osfamily_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
end

[['Fedora', 'fedora/f32', 32], ['CentOS', 'el/7', 7], ['Amazon', 'el/6', 2017], ['Amazon', 'el/7', 2]].each do |os, urlbit, osmajor|
[['Fedora', 'fedora/f34', 34], ['CentOS', 'el/7', 7], ['Amazon', 'el/6', 2017], ['Amazon', 'el/7', 2]].each do |os, urlbit, osmajor|
context "with #{os} and #{urlbit}" do
let(:facts) do
super().merge(:operatingsystem => os, :operatingsystemmajrelease => osmajor)
Expand Down
13 changes: 12 additions & 1 deletion task_spec/spec/acceptance/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ def bolt_config
end

def bolt_inventory
hosts_to_inventory
host_data = hosts_to_inventory
host_data['nodes'].each do |node_data|
node_data['config']['winrm']['connect-timeout'] = 120 if target_platform =~ %r{win}
end

host_data
end

def target_platform
Expand All @@ -37,10 +42,16 @@ def target_platform
'6.18.0'
when %r{osx-10.15}
'6.15.0'
when %r{osx-11}
'6.23.0'
else
'6.17.0'
end

# extra request is needed on windows hosts
# this will fail with "execution expired"
run_task('puppet_agent::version', 'target', {}) if target_platform =~ %r{win}

# Test the agent isn't already installed and that the version task works
results = run_task('puppet_agent::version', 'target', {})
results.each do |res|
Expand Down
2 changes: 1 addition & 1 deletion tasks/facts_diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run
}

command = [puppet_bin, 'facts', 'diff']
command << "--exclude" << @exclude if @exclude && ! @exclude.empty?
command << "--exclude" << "\"#{Regexp.new(@exclude).to_s}\"" if @exclude && ! @exclude.empty?

run_result = Puppet::Util::Execution.execute(command, options)

Expand Down
7 changes: 7 additions & 0 deletions tasks/install_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,19 @@ if [ -f "$PT__installdir/facts/tasks/bash.sh" ]; then
platform_version=`sw_vers | awk '/^ProductVersion:/ { print $2 }'`

major_version=`echo $platform_version | cut -d. -f1,2`

# Excepting MacOS 10.x, the major version is the first number only
if ! echo "${major_version}" | grep -q '^10\.'; then
major_version=$(echo "${major_version}" | cut -d '.' -f 1);
fi

case $major_version in
"10.11") platform_version="10.11";;
"10.12") platform_version="10.12";;
"10.13") platform_version="10.13";;
"10.14") platform_version="10.14";;
"10.15") platform_version="10.15";;
"11") platform_version="11";;
*) echo "No builds for platform: $major_version"
exit 1
;;
Expand Down