Skip to content

Commit

Permalink
Use Test-PuppetInstalledVersion instead of Test-PuppetInstalled
Browse files Browse the repository at this point in the history
  • Loading branch information
cgorshing committed Nov 5, 2021
1 parent e24a8c1 commit 5b7318e
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions tasks/install_powershell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ catch [System.Management.Automation.CommandNotFoundException] {
}
}

function Test-PuppetInstalled {
$rootPath = 'HKLM:\SOFTWARE\Puppet Labs\Puppet'
try {
if (Get-ItemProperty -Path $rootPath) { RETURN $true }
}
catch {
RETURN $false
}
}

function Test-PuppetInstalledVersion {
$rootPath = 'HKLM:\SOFTWARE\Puppet Labs\Puppet'

Expand Down Expand Up @@ -82,7 +72,7 @@ if ($version) {
}
}
else {
if (Test-PuppetInstalled) {
if (Test-PuppetInstalledVersion) {
Write-Output "Version parameter not defined and agent detected. Nothing to do."
Exit
}
Expand Down Expand Up @@ -160,5 +150,5 @@ if($_noop -eq 'true') {
DownloadPuppet
InstallPuppet
Cleanup
Write-Output "Puppet Agent installed on $env:COMPUTERNAME"
Write-Output "Puppet Agent installed on $env:COMPUTERNAME"
}

0 comments on commit 5b7318e

Please sign in to comment.