On Wednesday, October 17, 2012 9:59:54 PM UTC-5, Beeny wrote:
>
> Trying to run this exec in one of our manifests. When the resource is run 
> during a puppet run, it returns a error code 87. But when I execute the 
> same command on command prompt, it returns 3010. Is there any way to dig 
> and and find out why the return codes are different. FYI, I am using the 
> sysnative path to avoid the file system redirection on windows. 
>
> Platform: Windows 2008R2 64 bit
> Running PE 2.6 agent and PE 2.6 master.
>
> Exec statement(It's horrendous I know....) :
>
> $AILogFile='C:\\Program Files\\HELLO_WORLD\\log\\IIS7.log'
>
>  
>
> exec { 'install_iis':
>
> [...]
>
>     returns => ['0','1003', '3010'],
>
>     unless  => 'REG QUERY 
> \"HKLM\SOFTWARE\HELLO_WORLD\AutoInstall\IISSubTypes\" /v IIS /t REG_DWORD 
> /d /f 1',
>
>     require => Exec['echo Install_IIS']
>     }
>
> Output if I do a puppet agent --debug --test:
>
> debug: Executing 'c:\Windows\sysnative\dism.exe /online /norestart 
> /logpath:"C:\temp\log.etw.txt" /enable-feature /ignor
> [...]
>
> featurename:"WCF-NonHTTP-Activation" >> "C:\\Program 
> Files\\HELLO_WORLD\\log\\IIS7.log" 2>&1 returned 87 instead of
> one of [0,1003,3010] at 
> /etc/puppetlabs/puppet/modules/win-iis-install/manifests/iis-config.pp:15
>
>
> But if I run on command line I get the below:
>
> C:\Program Files (x86)\Puppet Labs\Puppet 
> Enterprise\bin>c:\Windows\sysnative\dism.exe /online /norestart /logpath:
> [...]
>
>  
>
> C:\Program Files (x86)\Puppet Labs\Puppet Enterprise\bin>echo %errorlevel%
> 3010
>
>
>
> Any help? This has me completely stumped since I'm running puppet and 
> running the command from exactly the same command shell window on the 
> server. I ran:
>
>
I'm not well versed on Windows-specific aspects of Puppet, but in a more 
general context problems such as you describe are usually the result of 
differences in execution environment.  In particular, Puppet does not 
forward its own environment variables -- not even the PATH -- to processes 
it launches.  If the command you are trying to run requires anything in 
particular in its environment then you need to set those variables 
specifically in the Exec resource.  This behavior is intentional: it 
fosters consistent and (more) secure behavior when applying Execs.

Also, it might be worthwhile to investigate the meaning of exit code 87 for 
the command you are running.  If it's documented then that may help you in 
your troubleshooting.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/7LtaQ6a1qaUJ.
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-users?hl=en.

Reply via email to