Re: [Puppet Users] Duplicate declaration - hard to find...
I found the problem by making the classe temporarily non-parameterized and it threw an error "Invalid parameter application". I called this class in another file. I'll fix that up. Thanks for your help! Ugo -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/66d35eb1-a22f-4e7a-a6d4-7fdfeb870720%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Duplicate declaration - hard to find...
- Original Message - > From: "Ugo Bellavance" <u...@lubik.ca> > To: "puppet-users" <puppet-users@googlegroups.com> > Sent: Wednesday, 21 September, 2016 14:51:00 > Subject: Re: [Puppet Users] Duplicate declaration - hard to find... >> >> >> in a define all resources have to have unique names, error says in some >> case >> you do not. So you're either attempting to make 2 instances where >> application >> is 'agtweb' or something else, >> >> Show the actual code. And the actual code where you make 'agtweb' >> application. >> >> > Sorry here's the code: which one produced the actual error you had? Computer doesnt really have a concept of 'or' about code here. Again though, your file{} resources need to be unique, so when you have the first case you have to do: apache::varwwwatdsrcapp{"foo": application => "foo" } apache::varwwwatdsrcapp{"bar": application => "baz" } these are fine, but: apache::varwwwatdsrcapp{"foo": application => "foo" } apache::varwwwatdsrcapp{"bar": application => "foo" } is not because it would cause a duplicate file of the same name likewise apache::varwwwatdsrcapp{"foo": } apache::varwwwatdsrcapp{"bar": } would fail because you set a default on 'application' which would cause duplicates. > > Either: > > define apache::varwwwatdsrcapp ( > >$application = 'agtweb', >$client = '', >$envstage = '', > > ) { > > file { > "/var/www/atd/src/${application}": > ensure => directory, > owner => "deploy", > group => "deploy", > mode => 0755, > require => Class['apache::varwwwatdsrc'], > } > > } > > Or > > define apache::varwwwatdsrcapp ( > >$application = 'agtweb', >$client = '', >$envstage = '', > > ) { > > file { > '/var/www/atd/src/agtweb': > ensure => directory, > owner => "deploy", > group => "deploy", > mode => 0755, > require => Class['apache::varwwwatdsrc'], > } > > } > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/79dff55f-e972-4a9c-9636-3a0f5f44b84c%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/638693790.228597.1474462516945.JavaMail.zimbra%40devco.net. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Duplicate declaration - hard to find...
> > > in a define all resources have to have unique names, error says in some > case > you do not. So you're either attempting to make 2 instances where > application > is 'agtweb' or something else, > > Show the actual code. And the actual code where you make 'agtweb' > application. > > Sorry here's the code: Either: define apache::varwwwatdsrcapp ( $application = 'agtweb', $client = '', $envstage = '', ) { file { "/var/www/atd/src/${application}": ensure => directory, owner => "deploy", group => "deploy", mode => 0755, require => Class['apache::varwwwatdsrc'], } } Or define apache::varwwwatdsrcapp ( $application = 'agtweb', $client = '', $envstage = '', ) { file { '/var/www/atd/src/agtweb': ensure => directory, owner => "deploy", group => "deploy", mode => 0755, require => Class['apache::varwwwatdsrc'], } } -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/79dff55f-e972-4a9c-9636-3a0f5f44b84c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Duplicate declaration - hard to find...
- Original Message - > From: "Ugo Bellavance" <u...@lubik.ca> > To: "puppet-users" <puppet-users@googlegroups.com> > Sent: Wednesday, 21 September, 2016 14:29:50 > Subject: [Puppet Users] Duplicate declaration - hard to find... > Hi, > > I'm getting this error message when I run a puppet noop: > > Error 400 on SERVER: Duplicate declaration: File[/var/www/atd/src/agtweb] > is already declared in file > /etc/puppet/modules/apache/manifests/varwwwatdsrcapp.pp at line 17; cannot > redeclare at /etc/puppet/modules/apache/manifests/varwwwatdsrcapp.pp:17 > > Here's the contents of the file (I tried with the app1 directly or using > the ${application} variable not really useful to show code other than the code producing the error. in a define all resources have to have unique names, error says in some case you do not. So you're either attempting to make 2 instances where application is 'agtweb' or something else, Show the actual code. And the actual code where you make 'agtweb' application. > > define apache::varwwwatdsrcapp ( > >$application = 'app1', >$client = '', >$envstage = '', > > ) { > > file { > #"/var/www/atd/src/${application}": >'/var/www/atd/src/app1': > ensure => directory, > owner => "deploy", > group => "deploy", > mode => 0755, > require => Class['apache::varwwwatdsrc'], > } > > } > > Contents of the file containing the required class: > > class apache::varwwwatdsrc { > > file { '/var/www/atd/src': > ensure => directory, > owner => "root", > group => "root", > mode => 0755, > require => File["/var/www/atd"], > } > > } > > Contents of the file containing the required File: > > class apache::varwwwatd { > > file { '/var/www/atd': > ensure => 'directory', > owner => 'root', > group => 'root', > mode => 0744, > } > > } > > I realize that I use double quotes where I shouldn't, but I don't think > that affects the logic. > > Any ideas where the problem may be? > > Thanks, > > Ugo > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/4b843ccb-c2ba-4f4d-9b9b-6ae7da9d16b0%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/1063999239.209562.1474461266280.JavaMail.zimbra%40devco.net. For more options, visit https://groups.google.com/d/optout.
[Puppet Users] Duplicate declaration - hard to find...
Hi, I'm getting this error message when I run a puppet noop: Error 400 on SERVER: Duplicate declaration: File[/var/www/atd/src/agtweb] is already declared in file /etc/puppet/modules/apache/manifests/varwwwatdsrcapp.pp at line 17; cannot redeclare at /etc/puppet/modules/apache/manifests/varwwwatdsrcapp.pp:17 Here's the contents of the file (I tried with the app1 directly or using the ${application} variable define apache::varwwwatdsrcapp ( $application = 'app1', $client = '', $envstage = '', ) { file { #"/var/www/atd/src/${application}": '/var/www/atd/src/app1': ensure => directory, owner => "deploy", group => "deploy", mode => 0755, require => Class['apache::varwwwatdsrc'], } } Contents of the file containing the required class: class apache::varwwwatdsrc { file { '/var/www/atd/src': ensure => directory, owner => "root", group => "root", mode => 0755, require => File["/var/www/atd"], } } Contents of the file containing the required File: class apache::varwwwatd { file { '/var/www/atd': ensure => 'directory', owner => 'root', group => 'root', mode => 0744, } } I realize that I use double quotes where I shouldn't, but I don't think that affects the logic. Any ideas where the problem may be? Thanks, Ugo -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4b843ccb-c2ba-4f4d-9b9b-6ae7da9d16b0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.