Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
PUP 2.7.25, PUP 3.3.1
-
3
-
Platform Client 2014-11-26, Platform Client 2014-12-17, Platform Client 2015-01-07, Platform Client 2015-01-21
Description
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
|
The solution to this was to generate a uniqueness key based on [name, provider], as mentioned by andy. That allows the example above to work, but doesn't resolve when multiple providers manage the same package. Several changes were needed:
- Set paramclass(:provider).isnamevar on the Package type, so the :provider parameter is recognized as part of the namevar.
- Overloaded the title_patterns method on the Package type, so the title could be parsed into namevars (it only sets :name, not :provider).
- The catalog assumed that isomorphic resources only needed to be aliased if the title and name didn't match. An alias is automatically created for a resource's title; if titles don't match but the namevar does they should still refer to the same thing. However, name is not equivalent to namevar for a composite namevar, so the test for whether to create an alias uses the uniqueness_key (an array containing all namevars). The impact of this change is to correctly identify when a resource with a composite namevar has already been created, as in
package { "add-mysql":
name => "mysql",
ensure => present,
}
package { "mysql":
ensure => present,
}
- The change to catalog means that creating aliases now depends on the uniqueness_key. That implementation in resource type could end up returning an array without the name specified if the :name parameter wasn't specifically specified. This change was made so conflicts between implicit and explicit default provider are detected at catalog compilation instead of trying to apply the manifest.
Changes (1) and (2) are required for any provider that uses a composite namevar.
Impact of this change:
- Querying resources by name on the command-line when multiple packages from different providers are specified only returns the package with the default provider (
PUP-3721). - Referring to Package resources by Package[$namevar] in Puppet code doesn't work for a composite namevar, so it no longer works for Package. Querying by Package[$title] still works. This is a breaking change in Puppet 4.
Attachments
Issue Links
- is duplicated by
-
PUP-4276 different package types share namespace
-
- Closed
-
-
PUP-2313 Package resources should use $title rather than $name to determine uniqueness
-
- Closed
-
- relates to
-
PUP-4184 Puppet resource package behaves inconsistently for packages with same name from different providers
-
- Closed
-
-
PUP-6516 support the same service name in resources with multiple providers
-
- Closed
-
-
PUP-1287 Manage both 32 and 64-bit packages with the same name
-
- Closed
-
-
PUP-3721 Puppet resource should always emit the provider
-
- Resolved
-
-
SERVER-360 Fix createrepo issue with ruby puppet acceptance tests
-
- Closed
-
- clones
- links to