Showing with 59 additions and 27 deletions.
  1. +9 −0 CHANGELOG.md
  2. +1 −1 metadata.json
  3. +12 −3 tasks/install.json
  4. +2 −1 tasks/install_powershell.json
  5. +10 −6 tasks/install_powershell.ps1
  6. +2 −1 tasks/install_shell.json
  7. +23 −15 tasks/install_shell.sh
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.7.0] - 2021-05-12

### Summary
Support running `puppet_agent::install` task in no-operation mode.

### Features

- ([MODULES-11066](https://tickets.puppetlabs.com/browse/MODULES-11066)) Support running `puppet_agent::install` task in no-operation mode ([#559](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/559))

## [4.6.1] - 2021-04-27

### Summary
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-puppet_agent",
"version": "4.6.1",
"version": "4.7.0",
"author": "puppetlabs",
"summary": "Upgrades All-In-One Puppet Agents",
"license": "Apache-2.0",
Expand Down
15 changes: 12 additions & 3 deletions tasks/install.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@
}
},
"implementations": [
{"name": "install_shell.sh", "requirements": ["shell"], "files": ["facts/tasks/bash.sh"], "input_method": "environment"},
{"name": "install_powershell.ps1", "requirements": ["powershell"]}
]
{
"name": "install_shell.sh",
"requirements": ["shell"],
"files": ["facts/tasks/bash.sh"],
"input_method": "environment"
},
{
"name": "install_powershell.ps1",
"requirements": ["powershell"]
}
],
"supports_noop": true
}
3 changes: 2 additions & 1 deletion tasks/install_powershell.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"type": "Optional[Integer]",
"default": 5
}
}
},
"supports_noop": true
}
16 changes: 10 additions & 6 deletions tasks/install_powershell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Param(
[String]$windows_source = 'https://downloads.puppet.com',
[String]$install_options = 'REINSTALLMODE="amus"',
[Bool]$stop_service = $False,
[Int]$retry = 5
[Int]$retry = 5,
[Bool]$_noop = $False
)
# If an error is encountered, the script will stop instead of the default of "Continue"
$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -153,8 +154,11 @@ function Cleanup {
Remove-Item -Force $install_log
}

DownloadPuppet
InstallPuppet
Cleanup

Write-Output "Puppet Agent installed on $env:COMPUTERNAME"
if($_noop -eq 'true') {
Exit
} else {
DownloadPuppet
InstallPuppet
Cleanup
Write-Output "Puppet Agent installed on $env:COMPUTERNAME"
}
3 changes: 2 additions & 1 deletion tasks/install_shell.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"default": 5
}
},
"files": ["facts/tasks/bash.sh"]
"files": ["facts/tasks/bash.sh"],
"supports_noop": true
}
38 changes: 23 additions & 15 deletions tasks/install_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ log () {
}

info () {
if [[ $PT__noop != true ]]; then
log "INFO: ${1}"
fi
}

warn () {
Expand Down Expand Up @@ -560,12 +562,16 @@ info "Downloading Puppet $version for ${platform}..."
case $platform in
"SLES")
info "SLES platform! Lets get you an RPM..."
for key in "puppet" "puppet-20250406"; do
gpg_key="${tmp_dir}/RPM-GPG-KEY-${key}"
do_download "https://yum.puppet.com/RPM-GPG-KEY-${key}" "$gpg_key"
rpm --import "$gpg_key"
rm -f "$gpg_key"
done

if [[ $PT__noop != true ]]; then
for key in "puppet" "puppet-20250406"; do
gpg_key="${tmp_dir}/RPM-GPG-KEY-${key}"
do_download "https://yum.puppet.com/RPM-GPG-KEY-${key}" "$gpg_key"
rpm --import "$gpg_key"
rm -f "$gpg_key"
done
fi

filetype="noarch.rpm"
filename="${collection}-release-sles-${platform_version}.noarch.rpm"
download_url="${yum_source}/${filename}"
Expand Down Expand Up @@ -653,17 +659,19 @@ case $platform in
;;
esac

download_filename="${tmp_dir}/${filename}"
if [[ $PT__noop != true ]]; then
download_filename="${tmp_dir}/${filename}"

do_download "$download_url" "$download_filename"
do_download "$download_url" "$download_filename"

install_file $filetype "$download_filename"
install_file $filetype "$download_filename"

if [[ $PT_stop_service = true ]]; then
/opt/puppetlabs/bin/puppet resource service puppet ensure=stopped enable=false
fi
if [[ $PT_stop_service = true ]]; then
/opt/puppetlabs/bin/puppet resource service puppet ensure=stopped enable=false
fi

#Cleanup
if test "x$tmp_dir" != "x"; then
rm -r "$tmp_dir"
#Cleanup
if test "x$tmp_dir" != "x"; then
rm -r "$tmp_dir"
fi
fi