Hi Anoop,
On Thu, Jun 28, 2012 at 2:26 PM, Anoop Gopalakrishnan
<
anoo...@gmail.com> wrote:
>
> Hi ,
> I am new to Puppet and I just started testing it out in my windows machine to do a set of tasks which I do manually currently and once I get the hang of it would like to use it for provisioning later. My current task is pretty simple:
> 1. Run an svn update command on a folder
> 2. Run maven install command
> 3. ... a whole bunch of other tasks related to setting up a custom server on a users machine.
>
> However , when I run an exec like the below, I can see that the maven runs successfully but the task fails at the end as shown below:
>
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] Compiling 59 source files to C:\Users\agopalakrishnan\SourceCode\CM-Server\implementation\test-console\target\classes
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] ------------------------------------------------------------------------
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] BUILD SUCCESSFUL
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] ------------------------------------------------------------------------
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] Total time: 6 seconds
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] Finished at: Thu Jun 28 14:14:37 PDT 2012
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] Final Memory: 48M/229M
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: [INFO] ------------------------------------------------------------------------
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: 'cmd' is not recognized as an internal or external command,
Your mvn.bat script is trying to invoke cmd, but failing because the
PATH environment is not correct, see more below.
> /Stage[main]/Cmserver/Exec[mvninstall]/returns: operable program or batch file.
> Error: C:\Windows\SysWow64\cmd.exe /c mvn.bat compile returned 1 instead of one of [0]
Just a side note, since ruby is a 32-bit executable, file system
redirection takes effect, causing puppet to launch the 32-bit cmd.exe.
This may or may not be an issue for you depending on what you are
trying to do. There's more info here[1]
> Error: /Stage[main]/Cmserver/Exec[mvninstall]/returns: change from notrun to 0 failed: C:\Windows\System32\cmd.exe /c mvn.bat compile returned 1 instead of one
> of [0]
> /Stage[main]/Cmserver/File[testfile]: Dependency Exec[mvninstall] has failures:true
> Warning: /Stage[main]/Cmserver/File[testfile]: Skipping because of failed dependencies
> Finished catalog run in 9.25 seconds
>
> The task is as below:
> exec { 'mvninstall':
> cwd => 'C:\Users\agopalakrishnan\SourceCode\CM-Server\implementation\test-console',
> path => 'C:/Users/agopalakrishnan/Software/apache-maven-2.2.1/bin;%PATH%',
> command => 'C:\Windows\System32\cmd.exe /c mvn.bat compile',
> provider => windows,
> logoutput => true,
> timeout => 1000,
> }
Puppet doesn't expand environment variables the way you are thinking.
Change that to:
path => "C:/Users/agopalakrishnan/Software/apache-maven-2.2.1/bin;${path}",
When compiling the catalog, the `path` parameter (for the exec
resource) will be interpolated using the `path` fact as reported by
the agent. More about using variables here[2]
> Any help is greatly appeciated.
>
> Regards,
> Anoop
>
> --
> 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/-/E9MOpAK6U5MJ.
> To post to this group, send email to
puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
puppet-users...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Josh
[1]
https://projects.puppetlabs.com/issues/12980
[2]
http://docs.puppetlabs.com/learning/variables.html
--
Josh Cooper
Developer, Puppet Labs