[Puppet Users] Re: Issue: packages with same name, different providers.

jcbollinger
Fri, 04 May 2012 13:05:35 -0000

On May 3, 10:29 am, Alan Franzoni <mail...@franzoni.eu>
wrote:
> Hello,
> I''ve just run into an issue I''m not able to solve.
>
> I need to have puppet install both the mysql package through yum, AND
> the mysql gem.
>
> Those are the pieces of my config as I''m trying to use it:
>
> package { ''mysql-all'':
>         ensure => latest,
>          name => ''mysql'',
>          provider => yum,
>         }
>
>     package { ''gem_mysql'':
>             ensure => latest,
>             name => ''mysql'',
>             provider => gem,
>             }
>
> error from puppet agent:
>
> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot
> alias Package[mysql-all] to ["mysql"] at
> /etc/puppet/modules/mysql/manifests/init.pp:21; resource
["Package",
> "mysql"] already declared at
> /etc/puppet/modules/redmine/manifests/dependencies.pp:80 at
> /etc/puppet/modules/mysql/manifests/init.pp:21 on node alan.dev.centos6
>
> I must set the name parameter because it''s the one that gets used
by the
> package manager, I''ve chosen different names for the resources but
it
> seems like puppet internally forces creating an alias using the package
> name.


The $name parameter is both the packaging system''s name for the
package and the Puppet name for the Package.  If you do not specify
the name parameter then it is taken from the resource title, but
setting different titles, as you have done, does not prevent a name
collision when you specify the same name for different packages.


> I''ve tried manually setting an alias, but nothing changes.
>
> puppetmaster: Debian squeeze, puppet 2.7.14
>
> client: Centos 6 32 bit, puppet 2.7.14.
>
> What should I do?


The best solution would be to create an RPM of the contents of the
Ruby gem, put it in a local repository, and install it via Yum.

Supposing that the gem is targeted at the system''s Ruby (instead of at
some additional, local, Ruby installation), installing via an RPM is
better administratively, as well.  It is never good to have multiple
agents managing overlapping spaces.


John