Hello,

Thanks for your answer.

I understand the restriction about resource name uniqueness, but I
don't understand the practical usage of it on the package resources.

Let's say there is two modules totally different, written by two
different developpers, but both depending on the same debian
package :
the two developper wills use the simplified syntax of the package
resource such package { "MODULE_NAME" : ensure => installed }, like we
can see it on usual puppet sample on internet.

Then, when an administrator will include the two modules, it will fail
because the same package is defined twice, even if the description of
the resource is exactly the same.

It doesn't sound as a normal behavior to me, unless if a best practice
is to never use the simplified syntax for package resource ?

Or is there an other best practice for avoiding this situation ?

Thanks in advance for your answers.

Best regards.
Christophe


On 4 avr, 00:15, Miguel Di Ciurcio Filho <miguel.fi...@gmail.com>
wrote:
> On Tue, Apr 3, 2012 at 3:33 PM, Christophe L <cl.subscript...@gmail.com> 
> wrote:
> > Hello,
>
> > We had the following situation where including two classes that were
> > ensuring the installation of the same package "php5-imagick" and it
> > was causing an error indicating that two ressources of the same name
> > are forbidden (sorry, I don't have the exact message error since we
> > fixed quickly the error).
>
> By the nature of the Puppet's language, resources must have a unique
> title and must have only one definition.
>
> Quotinghttp://docs.puppetlabs.com/guides/language_guide.html#resources:
>
> "The field before the colon is the resource’s title, which must be
> unique and can be used to refer to the resource in other parts of the
> Puppet configuration."
>
> > Code causing the error:
>
> > /etc/puppet/modules/apache/manifests/init.pp
>
> > class apache::install {
> >  ...
> >  package { [ "php5", "php5-cli", "php5-gd", "php5-imagick", "php5-
> > mysql", "phpmyadmin", "mysql-client" ]:
> >        ensure => installed,
> >  }
>
> The line above is just a shortcut to this something like this:
>
> package {"php5": .... }
> package {"php5-cli": .... }
> package {"php5-imagick": .... }
>
> So when Puppet compiles all your manifests, there can be only one
> php5-imagick, in your case.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to