Anoop Gopalakrishnan
2012-Jun-28 21:26 UTC
[Puppet Users] Puppet windows newbie: command runs but ends with failure
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, /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] 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, } 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-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-Jun-28 22:06 UTC
Re: [Puppet Users] Puppet windows newbie: command runs but ends with failure
Hi Anoop, On Thu, Jun 28, 2012 at 2:26 PM, Anoop Gopalakrishnan <anoop2811@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-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 [1] https://projects.puppetlabs.com/issues/12980 [2] http://docs.puppetlabs.com/learning/variables.html -- Josh Cooper Developer, Puppet Labs -- 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.
Anoop Gopalakrishnan
2012-Jun-28 22:56 UTC
[Puppet Users] Re: Puppet windows newbie: command runs but ends with failure
Hey Josh, Thanks for the quick response! Will try out the changes. Appreciate the good work too. Regards, Anoop On Thursday, June 28, 2012 2:26:38 PM UTC-7, Anoop Gopalakrishnan 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, > /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] > 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, > } > > 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/-/Z_PMG8FghuYJ. 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.