Issue #1398 has been updated by Pedro CĂ´rte-Real.

Adrien, your example doesn't work of course because you can't have two 
resources with the same name, but you don't need that for this to work. An 
example would be:

    package { 'somepackage-in-apt':
      ensure => present,
      pkgname => 'somepackage',
      provider => apt,  
    }

    package { 'somepackage-in-gem':
      ensure => absent,
      pkgname => 'somepackage',
      provider => gem,
    }

And this would properly ensure the package is installed through apt and not 
rubygems. Your apt/dpkg example is a corner case since in the outside (puppet) 
world apt is layered on top of dpkg. It's up to the user that "if it hurts when 
you do that, stop doing that".

Not having looked at the code I do think this shouldn't be such a complex fix 
as the current difficulty isn't enforced by the puppet type system, just by the 
fact that the current package implementation uses $name for setting the package 
instead of $my_other_random_name_variable. Creating $pkgname ||= $name like I 
suggested would fix this while being backwards compatible.

----------------------------------------
Feature #1398: Common package name in two different providers
https://projects.puppetlabs.com/issues/1398#change-97475

* Author: Lawrence Ludwig
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: package
* Target version: 
* Affected Puppet version: 2.7.21
* Keywords: package alias
* Branch: 
----------------------------------------
I have a common package name, that's in two different package managers
(one with yum the other with gem)

        package { "remove-mysql":
                name     => "mysql",
                provider => "yum",
                ensure   => absent,
        }

---------------------------------------------------------

        package { "gem-mysql":
                name    => "mysql",
                ensure   => "2.7",
                provider => gem,
        }
---------------------------------------------------------

I get this error.

Jul  3 08:43:34 puppetd[11872]: Could not retrieve catalog:
Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot
alias Package[gem-mysql] to mysql; resource Package[mysql] already
exists at /etc/puppet/modules/ruby-mysql/manifests/init.pp:11 on node 


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to