Rost
2012-Aug-10 10:40 UTC
[Puppet Users] Duplicate definition of resources in the same class
Hi all, I am struggling on how to do this : $path = ''/tmp/lib'' file { $path: ensure => directory, recurse => true, purge => true, } file { $path: ensure => directory, resurce => true, source => ''puppet:///modules/jboss/lib } When puppet compiles the manifest, I get the following error: * Duplicate declaration: File[/tmp/lib] is already declared in file /etc/puppet/modules/srhjboss/manifests/purge.pp at line 4; cannot redeclare at /etc/puppet/modules/srhjboss/manifests/purge.pp:10 on node frparsrnlinnto * * * It seems that i can''t purge the directory before to copy the new one from the source. Suggestions ?? Thanks -- 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/-/fIEAVZn8Ai8J. 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.
Axel Bock
2012-Aug-10 10:55 UTC
[Puppet Users] Re: Duplicate definition of resources in the same class
easy. every resource may only be defined _once_. you try ... twice (file { $path : ... } and file { $path: ... }, right?) why not simply file { $path: ensure => directory, recurse => true, purge => true, source => ''puppet:///modules/jboss/lib } ? if you _need_ to do this twice for whatever reason, do something like this (but you SHOULD NOT): file { "$path/0": $path => $path, ensure => directory, recurse => true, purge => true, } file { "$path/1": path => $path, ensure => directory, resurce => true, source => ''puppet:///modules/jboss/lib } cause puppet identifies the resource by the title, which must differ, which it does not. note THAT THIS IS NOT THE RIGHT WAY :) . HTH & greetings, Axel. Am Freitag, 10. August 2012 12:40:21 UTC+2 schrieb Rost:> > Hi all, > > I am struggling on how to do this : > > $path = ''/tmp/lib'' > > file { $path: > ensure => directory, > recurse => true, > purge => true, > } > > file { $path: > ensure => directory, > resurce => true, > source => ''puppet:///modules/jboss/lib > } > > When puppet compiles the manifest, I get the following error: > > * Duplicate declaration: File[/tmp/lib] is already declared in file > /etc/puppet/modules/srhjboss/manifests/purge.pp at line 4; cannot redeclare > at /etc/puppet/modules/srhjboss/manifests/purge.pp:10 on node frparsrnlinnto > * > * > * > It seems that i can''t purge the directory before to copy the new one from > the source. > > Suggestions ?? > Thanks >-- 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/-/sxb-OBGRKiAJ. 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.
Rost
2012-Aug-10 11:22 UTC
[Puppet Users] Re: Duplicate definition of resources in the same class
Hi Axel Thanks a lot, you solution is right. Le vendredi 10 août 2012 12:40:21 UTC+2, Rost a écrit :> > Hi all, > > I am struggling on how to do this : > > $path = ''/tmp/lib'' > > file { $path: > ensure => directory, > recurse => true, > purge => true, > } > > file { $path: > ensure => directory, > resurce => true, > source => ''puppet:///modules/jboss/lib > } > > When puppet compiles the manifest, I get the following error: > > * Duplicate declaration: File[/tmp/lib] is already declared in file > /etc/puppet/modules/srhjboss/manifests/purge.pp at line 4; cannot redeclare > at /etc/puppet/modules/srhjboss/manifests/purge.pp:10 on node frparsrnlinnto > * > * > * > It seems that i can''t purge the directory before to copy the new one from > the source. > > Suggestions ?? > Thanks >-- 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/-/2YJqTnc2n6AJ. 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.