Hi,

On 02/20/2013 06:43 AM, Rakesh Kathpal wrote:
>         file { 'install':
>         path => "c:\install.bat",
...
>      exec {'install_sw':
>      file { 'remove':
>         ensure  => absent,
...
> I am quite sure that there is something
> syntactically wrong my code but donno what? Can someone please shed some
> light on this?

Actually, sorry to say this, but there's something conceptually wrong
with this.

You're walking into the "C-like programming language" trap. The thing is
- the puppet DSL is nothing like traditional, statement based
programming. The above are not three statements that are executed in
order. They are supposed to be three properties of system state.

You are telling puppet that you want it to make sure three things hold true:
1. c:\install.bat is present and has specific content
2. c:\install.bat is getting executed
3. c:\install.bat is not on your system

1 and 3 are conflicting. Puppet cannot maintain a state in which both
are true. You will have a hard time bending puppet towards this behaviour.

I suggest you just get rid of the final file resource and let the
install.bat remain (but do choose a location that is better suited to
store such internal administrative data).

Also please note that you probably either want to add "refreshonly" to
your exec resource, but that is rather unclean design (if the execution
fails once, puppet will not know it needs to re-run because the file
will not notify it again).
The better alternative is a sensible "creates" or "unless" condition.

HTH,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to