Issue #9636 has been updated by Josh Cooper. Status changed from Accepted to In Topic Branch Pending Review Assignee set to Josh Cooper Target version set to 2.7.x Branch set to https://github.com/puppetlabs/puppet/pull/168
I've submitted a pull request that resolves onlyif and unless on Windows. Ideally, we could just use Process.spawn, but it's not available in ruby 1.8. And since $CHILD_STATUS is read-only, the easiest thing is to just create a shell that exits with the desired exit status, which has the effect of setting $CHILD_STATUS for us. ---------------------------------------- Bug #9636: unless and onlyif do not appear to behave as they should on windows 2008R2 https://projects.puppetlabs.com/issues/9636 Author: Eric Stonfer Status: In Topic Branch Pending Review Priority: Normal Assignee: Josh Cooper Category: windows Target version: 2.7.x Affected Puppet version: Keywords: Branch: https://github.com/puppetlabs/puppet/pull/168 exec {"set_tz": command => 'tzutil.exe /s "UTC" ', path => ['C:/Ruby187/bin','C:/product/11.1.0/client_1','C:/Windows/system32','C:/Windows','C:/Windows/System32/Wbem','C:/Windows/System32/WindowsPowerShell/v1.0/'], unless=>'hh.exe', } will never run. I've modified util.rb to spit out the error code. Output of a puppet apply --debug run below. I've used hh.exe as my check since it returns 0 when run with no args (and is simple the actual check is more complex) debug: Loaded state in 0.00 seconds debug: Loaded state in 0.02 seconds info: Applying configuration version '1316617482' debug: /Schedule[never]: Skipping device resources because running on a host debug: /Schedule[daily]: Skipping device resources because running on a host debug: /Schedule[monthly]: Skipping device resources because running on a host debug: /Schedule[puppet]: Skipping device resources because running on a host debug: /Schedule[hourly]: Skipping device resources because running on a host debug: Exec[set_tz](provider=windows): Executing check 'hh.exe' debug: Executing 'hh.exe' 0 debug: /Schedule[weekly]: Skipping device resources because running on a host debug: Finishing transaction 127929636 debug: Storing state debug: Stored state in 0.03 seconds notice: Finished catalog run in 0.31 seconds debug: /File[C:/ProgramData/PuppetLabs/puppet/var/rrd]/mode: mode changed '755' to '750' debug: /File[C:/ProgramData/PuppetLabs/puppet/var/rrd]: The container C:/Program Data/PuppetLabs/puppet/var/rrd will propagate my refresh event debug: Finishing transaction 127699992 debug: Recieved report to process from xxx.xxx.com debug: Processing report from xxx.xxx.com with processor Puppet::Reports::Store now changing the check to bfsvc.exe (which returns 87 with no arguments) debug: Finishing transaction 128688816 debug: Loaded state in 0.02 seconds debug: Loaded state in 0.00 seconds info: Applying configuration version '1316619308' debug: /Schedule[never]: Skipping device resources because running on a host debug: /Schedule[daily]: Skipping device resources because running on a host debug: /Schedule[monthly]: Skipping device resources because running on a host debug: /Schedule[puppet]: Skipping device resources because running on a host debug: /Schedule[hourly]: Skipping device resources because running on a host debug: Exec[set_tz](provider=windows): Executing check 'bfsvc.exe' debug: Executing 'bfsvc.exe' 87 debug: /Schedule[weekly]: Skipping device resources because running on a host debug: Finishing transaction 128875224 debug: Storing state debug: Stored state in 0.03 seconds notice: Finished catalog run in 0.23 seconds debug: /File[C:/ProgramData/PuppetLabs/puppet/var/rrd]/mode: mode changed '755' to '750' debug: /File[C:/ProgramData/PuppetLabs/puppet/var/rrd]: The container C:/Program Data/PuppetLabs/puppet/var/rrd will propagate my refresh event debug: Finishing transaction 128643912 debug: Recieved report to process from xxx.xxx.com debug: Processing report from xxx.xxx.com with processor Puppet::Reports::Store -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
