Last active
June 5, 2018 09:09
-
-
Save markwragg/c037f3656fe1e7229e85d43d73c2b506 to your computer and use it in GitHub Desktop.
A PowerShell function to invoke Puppet after it has completed its current run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Invoke-Puppet { | |
Param( | |
$Environment | |
) | |
if ($Environment) { $Environment = "--environment='$Environment'" } | |
while (Test-Path C:/ProgramData/PuppetLabs/puppet/cache/state/agent_catalog_run.lock) { | |
Write-Warning 'Puppet is already running. Waiting for it to finish..' | |
Start-Sleep 5 | |
} | |
puppet agent -t $Environment | |
} | |
Invoke-Puppet -Env dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment