Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Puppet Exec with Unless Fails on Windows

I am trying to execute the following manifest but it seems to fail even when the command works on the cmd prompt.

  exec { 'netframework40':
    command   => 'C:\Temp\WebPiCmd.exe /Install /Products:NETFramework4 /AcceptEula /Log:C:\Temp\NETFramework4Log.htm',
    logoutput => true,
    timeout   => 900,
    unless    => "C:\\Temp\\WebPiCmd.exe /List /ListOption:Installed | C:\\Windows\\System32\\findstr.exe 'NETFramework4'"
  }

exec { 'netframework40': command => 'C:\Temp\WebPiCmd.exe /Install /Products:NETFramework4 /AcceptEula /Log:C:\Temp\NETFramework4Log.htm', logoutput => true, timeout => 900, unless => 'C:\Temp\WebPiCmd.exe /List /ListOption:Installed | C:\Windows\System32\findstr.exe "NETFramework4"' }

Using the following command to execute this resource...

puppet apply -v -d init.pp

info: Applying configuration version '1366637030'
debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a host
debug: /Schedule[hourly]: Skipping device resources because running on a host
debug: Exec[netframework40](provider=windows): Executing check 'C:\Temp\WebPiCmd.exe /List /ListOption:Installed | C:\Windows\Syst
em32\findstr.exe 'NETFramework4''
debug: Executing 'C:\Temp\WebPiCmd.exe /List /ListOption:Installed | C:\Windows\System32\findstr.exe 'NETFramework4''
debug: /Stage[main]//Exec[netframework40]/unless: Invalid argument format '|'
debug: Exec[netframework40](provider=windows): Executing 'C:\Temp\WebPiCmd.exe /Install /Products:NETFramework4 /AcceptEula /Log:C
:\Temp\NETFramework4Log.htm'
debug: Executing 'C:\Temp\WebPiCmd.exe /Install /Products:NETFramework4 /AcceptEula /Log:C:\Temp\NETFramework4Log.htm'
notice: /Stage[main]//Exec[netframework40]/returns:
notice: /Stage[main]//Exec[netframework40]/returns: The software that you obtain using the Web Platform Installer Command Line Too
l is licensed to you by its owner.  Microsoft grants you no rights for third party software.
notice: /Stage[main]//Exec[netframework40]/returns: Successfully Loaded Feed : https://go.microsoft.com/?linkid=9810537
notice: /Stage[main]//Exec[netframework40]/returns: The following products are not available on this machine or already installed:
 NETFramework4
notice: /Stage[main]//Exec[netframework40]/returns: No products to be installed (either not available or already installed)
notice: /Stage[main]//Exec[netframework40]/returns: executed successfully
debug: /Stage[main]//Exec[netframework40]: The container Class[Main] will propagate my refresh event
debug: /Schedule[never]: Skipping device resources because running on a host
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host
debug: Class[Main]: The container Stage[main] will propagate my refresh event
debug: Finishing transaction 37780860
debug: Storing state
debug: Stored state in 0.06 seconds
notice: Finished catalog run in 4.28 seconds
debug: Finishing transaction 127695168

I am using Puppet Enterprise 2.8.1 for Windows 7.