Exec resource don't write file after the command

145 views
Skip to first unread message

Rost

unread,
Aug 8, 2012, 9:42:02 AM8/8/12
to puppet...@googlegroups.com
Hi all,

I'm trying to have the exec resource write a file after the command but it don't.

here is the resource declaration

class gepet {
notify { 'begin':}
file { '/root/essai/html':
ensure => present,
content => "Wrote By Yves Nton",
notify => Exec['test'],
}
exec { 'test':
path => "/usr/bin:/usr/sbin:/bin",
cwd => "/root/essai",
command => "rm -rf /root/essai/html",
creates => "/root/essai/exec.txt",
refreshonly => true
}
notify { 'end':
require => File['/root/essai/html']
}
}

suggestions ?
Thanks

Brian Gallew

unread,
Aug 8, 2012, 9:45:11 AM8/8/12
to puppet...@googlegroups.com
The "creates" attribute tells Puppet that the "command" attribute actually creates a file, and that the Exec{} should not be run if that file exists.  You need to alter your command:
command => "rm -rf /root/essai/html;touch /root/essai/exec.txt"

--
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/-/4u6oOxidJJUJ.
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.

Rost

unread,
Aug 8, 2012, 10:00:25 AM8/8/12
to puppet...@googlegroups.com
thanks Brian,

You are right !!!

It's working
Reply all
Reply to author
Forward
0 new messages