VT
2012-Oct-24 03:09 UTC
[Puppet Users] Exec python script on puppet clinet running on windows
I am trying to execute a python script from manifest file on puppet windows based client: exec {''ez_setup.py -U setuptools'': #command => ''C:\Python27\ez_setup.py -U setuptools'', cwd => ''C:\Python27'', path => ''C:\Python27;%PATH%'', #creates => ''C:\Program, require => File[''C:\Python27''], } I have ''file'' block as well, which is copies the file first, before execution. However, I am getting following error: ****************************************************************************** C:\Program Files\Puppet Labs\Puppet Enterprise\bin>puppet agent --test --server qalab2.pertino.com info: Retrieving plugin err: /File[C:/ProgramData/PuppetLabs/puppet/var/lib]: Could not evaluate: Could not retrieve information from environment production source(s) puppet://qalab2.p ertino.com/plugins info: Caching catalog for homebasic32.pertino.com info: Applying configuration version ''1351047345'' err: /Stage[main]//Exec[ez_setup.py -U setuptools]/returns: change from notrun to 0 failed: CreateProcess() failed: notice: Finished catalog run in 4.06 seconds ************************************************** I have no idea how to debug. Pls help! Great Thanks, Viktoriya -- 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/-/S3z9K-EZwoYJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Josh Cooper
2012-Oct-24 06:04 UTC
Re: [Puppet Users] Exec python script on puppet clinet running on windows
Hi Viktoriya, On Oct 23, 2012, at 8:09 PM, VT <vtoch@yahoo.com> wrote:> I am trying to execute a python script from manifest file on puppet windows based client: > > exec {''ez_setup.py -U setuptools'': > > #command => ''C:\Python27\ez_setup.py -U setuptools'', > > cwd => ''C:\Python27'', > > path => ''C:\Python27;%PATH%'', >That needs to be: path => "C:\\Python27;${path}" Since the catalog is compiled on the master, we need to use the value of the agent''s path fact. Since we''re interpolating, we have to use double quotes, which then means we have to escape backslashes.> #creates => ''C:\Program, > > require => File[''C:\Python27''], > > } > > I have ''file'' block as well, which is copies the file first, before execution. However, I am getting following error: > ****************************************************************************** > C:\Program Files\Puppet Labs\Puppet Enterprise\bin>puppet agent --test --server > qalab2.pertino.com > info: Retrieving plugin > err: /File[C:/ProgramData/PuppetLabs/puppet/var/lib]: Could not evaluate: Could > not retrieve information from environment production source(s) puppet://qalab2.p > ertino.com/plugins > info: Caching catalog for homebasic32.pertino.com > info: Applying configuration version ''1351047345'' > err: /Stage[main]//Exec[ez_setup.py -U setuptools]/returns: change from notrun > to 0 failed: CreateProcess() failed: > notice: Finished catalog run in 4.06 secondsI think that your command needs to be something like: "python.exe ez_setup.py ..." The issue is that the windows exec provider calls the Win32 API CreateProcess, which may not be able to execute the script directly. Ideally we''d have a shell provider on Windows, but we haven''t implemented one yet, e.g. to handle shell builtins like echo, mkdir, etc Also for general debugging, I recommend running with --debug to show what commands each provider is executing.> ************************************************** > I have no idea how to debug. Pls help! > > Great Thanks, > Viktoriya > > -- > 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/-/S3z9K-EZwoYJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.Josh -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.