Hi, Is it correct that it''s not possible to excecute Windows Commands directly with the puppet run? For example: exec { ''ExecCreatedFolder'': command => "mkdir C:\PuppetOrdner\ExecCreatedFolder", } I allways have to bind it with a .bat file right? file { ''c:/PuppetFolder/puppettest.bat'': ensure => file, owner => ''administrator'', content => "mkdir C:\PuppetFolder\BatchCreatedFolder", } exec { ''c:/PuppetFolder/puppettest.bat'': require => File[''c:/PuppetFolder/puppettest.bat''], } -- 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.
Hi Jay,> exec { ''ExecCreatedFolder'': > command => "mkdir C:\PuppetOrdner\ExecCreatedFolder", > }mkdir is a command implemented by the windows command processor cmd.exe, not a callable program. http://docs.puppetlabs.com/references/stable/type.html#exec states that the Windows provider can only call executables instead of giving commands to a shell. That said, have you tried something like ''command => "cmd /c mkdir c:\test"'' ? Also, I hope you bring up mkdir purely for the sake of discussion, since file { ''C:/test'': ensure => directory } works for creating directories. Cheers, Paul -- 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/-/Ih2d0TjkOYAJ. 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.
On 23 Mrz., 12:16, Paul Tötterman <paul.totter...@gmail.com> wrote:> Hi Jay, > > > exec { ''ExecCreatedFolder'': > > command => "mkdir C:\PuppetOrdner\ExecCreatedFolder", > > } > > mkdir is a command implemented by the windows command processor cmd.exe, > not a callable program.http://docs.puppetlabs.com/references/stable/type.html#execstates that the > Windows provider can only call executables instead of giving commands to a > shell. > > That said, have you tried something like ''command => "cmd /c mkdir > c:\test"'' ?I tried it and it didn''t work.. but I know what you mean. It''s OK> > Also, I hope you bring up mkdir purely for the sake of discussion, since > file { ''C:/test'': ensure => directory } works for creating directories.Yes, It was just an example :-) Just to try the ressource exec> > Cheers, > PaulThx for your quick answer. -- 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.
On Fri, Mar 23, 2012 at 4:33 AM, Jay Ze <iltisannihilator@googlemail.com>wrote:> On 23 Mrz., 12:16, Paul Tötterman <paul.totter...@gmail.com> wrote: > > Hi Jay, > > > > > exec { ''ExecCreatedFolder'': > > > command => "mkdir C:\PuppetOrdner\ExecCreatedFolder", > > > } > > > > mkdir is a command implemented by the windows command processor cmd.exe, > > not a callable program. > http://docs.puppetlabs.com/references/stable/type.html#execstates that the > > Windows provider can only call executables instead of giving commands to > a > > shell. > > > > That said, have you tried something like ''command => "cmd /c mkdir > > c:\test"'' ? > I tried it and it didn''t work.. but I know what you mean. > > It''s OK >The exec resource requires that command be an absolute path or that you specify the path parameter to resolve the executable. Since %windir% can vary across Windows agents, the easiest thing is to do use the agent''s path fact: exec { ''cmd /c echo hello'': path => $::path, logoutput => true } Also note that I didn''t specify a ''.exe'' extension. Puppet uses both the %PATH% and %PATHEXT% environment variables to resolve the executable. Or course, you can specify the extension if you want, e.g. cmd.exe /c echo hello.> > > Also, I hope you bring up mkdir purely for the sake of discussion, since > > file { ''C:/test'': ensure => directory } works for creating directories. > Yes, It was just an example :-) > Just to try the ressource exec > > > > Cheers, > > Paul > > Thx for your quick answer. > > -- > 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. > >-- 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.
Seemingly Similar Threads
- Puppet ssl errors " SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"
- Puppet 2.7.12 Windows - Dependency Problem
- Installing puppet master and puppetdb on the same host.
- Handling timeouts?
- Recommended method of running puppet periodically on mac os x