Using Puppet and PowerShell: Long running scripts with good manifest logging

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Rob Simmers Rob Simmers 3 weeks, 1 day ago.

  • Author
    Posts
  • #57842
    Profile photo of Kevin
    Kevin
    Participant

    I have complex PowerShell scripts that I would like Puppet manifests to govern. I use a PowerShell plugin. I can have Puppet manifests transfer a PowerShell script and run it. The relevant messages of a Puppet Agent running and associated logs on the Puppet Agent server and Puppet master server can show a success well before the PowerShell script has finished. Is there a way or trick to getting a Puppet manifest to not show such quick "successes" and wait for the entire PowerShell script to actually finish? The solution may be more of a PowerShell fix than a Puppet fix.

  • #57862
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    What is the behavior of launching an exe or Powershell in Puppet? Does it wait until Powershell.exe completes before continuing? It also matter what you doing in the Powershell code as well. Are you calling other EXE's or starting sub-processes in the Powershell code? My assumption is something is not set to wait until completion. Typically, Start-Process is used for EXE's because we can specify the -Wait parameter to have it not run any more code until the spawned process is complete. I also found this if it helps that Powershell is producing a non-terminating error that isn't being handled by Puppet:

    https://puppet.com/blog/tips-using-puppet-powershell-module

You must be logged in to reply to this topic.