Ask Your Question
-1

Puppet Exec with Unless Fails on Windows

asked 2013-04-22 08:28:54 -0500

louis gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-04-22 13:48:27 -0500

jonn gravatar image

updated 2013-04-22 14:00:14 -0500

I guess that this is the problem?

debug: /Stage[main]//Exec[netframework40]/unless: Invalid argument format '|'

Does it help if you wrap it in a cmd process, something like this?

unless => 'cmd /c "C:\\Temp\\WebPiCmd.exe /List /ListOption:Installed | C:\\Windows\\System32\\findstr.exe NETFramework4"'
edit flag offensive delete link more

Comments

Thanks. It worked!

louis gravatar imagelouis ( 2013-04-22 19:02:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-22 08:28:54 -0500

Seen: 1,927 times

Last updated: Apr 22 '13