Jira (PUP-10394) puppet cannot handle same package name with different providers

0 views
Skip to first unread message

Ciprian Badescu (Jira)

unread,
Mar 27, 2020, 8:53:03 AM3/27/20
to puppe...@googlegroups.com
Ciprian Badescu created an issue
 
Puppet / Improvement PUP-10394
puppet cannot handle same package name with different providers
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2020/03/27 5:52 AM
Priority: Normal Normal
Reporter: Ciprian Badescu

While testing package providers I hit the case on Ubuntu14.04/x86_64 where the same package is present on both apt and pip providers. While individually the packages can be handled, there are issues on:

  • output on `puppet resource package`, where only the default package gets listed
  • having both packages in the same manifest

root@sleek-clergymen:~# puppet resource package ssh-import-id ensure=present provider=pip
package { 'ssh-import-id':
  ensure => '3.21',
}
root@sleek-clergymen:~# pip freeze | grep ssh-import-id
ssh-import-id==3.21
root@sleek-clergymen:~# puppet resource package | grep -A 2 ssh-import-id
package { 'ssh-import-id':
  ensure => '3.21-0ubuntu1',
}
 
root@sleek-clergymen:~# cat a.pp
package { 'ssh-import-id':
  ensure => '3.21',
  provider => 'pip',
}
package { 'ssh-import-id':
  ensure => '3.21-0ubuntu1',
}
root@sleek-clergymen:~# puppet apply a.pp
Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[ssh-import-id] is already declared at (file: /root/a.pp, line: 1); cannot redeclare (file: /root/a.pp, line: 5) (file: /root/a.pp, line: 5, column: 1) on node sleek-clergymen.delivery.puppetlabs.net

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Mar 27, 2020, 5:48:03 PM3/27/20
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10394
 
Re: puppet cannot handle same package name with different providers

This issue should already be supported, see PUP-1073

In PUP-3721 (fixed in 6.13.0), puppet resource package now emits the provider that was used, to avoid naming collisions. You can achieve the same effect in 5.5.x using puppet resource package --param provider.

In order to manage two packages with the same name, you have to specify the provider for both resources, which I think is why this fails:

 

root@sleek-clergymen:~# cat a.pp
package

{ 'ssh-import-id': ensure => '3.21', provider => 'pip', }

package

{ 'ssh-import-id': ensure => '3.21-0ubuntu1', }

 

I don't think puppet will generate the composite key for the resource if the provider is unspecified, and it picks the most suitable provider.

See also https://github.com/puppetlabs/puppet/blob/master/acceptance/tests/resource/package/common_package_name_in_different_providers.rb

Josh Cooper (Jira)

unread,
Mar 27, 2020, 5:53:06 PM3/27/20
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Mar 31, 2020, 3:23:03 AM3/31/20
to puppe...@googlegroups.com
Ciprian Badescu commented on Improvement PUP-10394
 
Re: puppet cannot handle same package name with different providers

On 5.5.x, having '--param provider' or specifying second provider in manifest does not seems to help:

[root@ski-residence ~]# cat b.pp
package { 'postgresql':
  ensure   => present,
  provider => 'dnfmodule',
}
package { 'postgresql':
  ensure   => present,
  provider => 'dnf',
}
 
[root@ski-residence ~]# puppet apply b.pp
Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[postgresql] is already declared at (file: /root/b.pp, line: 1); cannot redeclare (file: /root/b.pp, line: 5) (file: /root/b.pp, line: 5, column: 1) on node ski-residence.delivery.puppetlabs.net
[root@ski-residence ~]# puppet resource package postgresql provider=dnfmodule ensure=present
package { 'postgresql':
  ensure => '12',
}
[root@ski-residence ~]# puppet resource package postgresql provider=dnf ensure=present
package { 'postgresql':
  ensure => '12.1-2.module_el8.1.0+273+979c16e6',
}
[root@ski-residence ~]# puppet resource package --param=provider | grep "'postgresql'" -A 3
package { 'postgresql':
  ensure   => '12.1-2.module_el8.1.0+273+979c16e6',
  provider => 'dnf',
}
 

Ciprian Badescu (Jira)

unread,
Mar 31, 2020, 3:28:03 AM3/31/20
to puppe...@googlegroups.com

And 6.14.0 seems to behave the same:

[root@ski-residence ~]# puppet --version
6.14.0
[root@ski-residence ~]# puppet apply b.pp
Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[postgresql] is already declared at (file: /root/b.pp, line: 1); cannot redeclare (file: /root/b.pp, line: 5) (file: /root/b.pp, line: 5, column: 1) on node ski-residence.delivery.puppetlabs.net
[root@ski-residence ~]# puppet resource package postgresql provider=dnf ensure=present
package { 'postgresql':
  ensure   => '12.1-2.module_el8.1.0+273+979c16e6',
  provider => 'dnf',
}
[root@ski-residence ~]# puppet resource package postgresql provider=dnfmodule ensure=present
package { 'postgresql':
  ensure   => '12',
  provider => 'dnfmodule',
}
[root@ski-residence ~]# puppet resource package --param=provider | grep "'postgresql'" -A 3
package { 'postgresql':
  ensure   => '12.1-2.module_el8.1.0+273+979c16e6',
  provider => 'dnf',
}

Mihai Buzgau (Jira)

unread,
Mar 31, 2020, 10:53:05 AM3/31/20
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Apr 8, 2020, 5:38:03 AM4/8/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Nov 5, 2020, 3:50:03 AM11/5/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Nov 5, 2020, 3:52:05 AM11/5/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 15, 2021, 6:49:01 PM6/15/21
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10394
 
Re: puppet cannot handle same package name with different providers

Ah I think this is a duplicate of two other bugs.

The issue of puppet resource package hiding packages from multiple providers is PUP-7497. I left a note and potential patch in that ticket.

The issue of multiple packages with the same name in a manifest is PUP-5302. Puppet requires the title to be unique, so you have to give it a dummy title and specify the name parameter separately:

[root@wild-enthusiast ~]# cat a.pp
package { 'uuid':
  ensure => present,
  provider => 'gem'
}
 
package { 'uuid':
  ensure => present,
  provider => 'yum'
}
[root@wild-enthusiast ~]# puppet apply a.pp
Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[uuid] is already declared at (file: /root/a.pp, line: 1); cannot redeclare (file: /root/a.pp, line: 6) (file: /root/a.pp, line: 6, column: 1) on node wild-enthusiast.delivery.puppetlabs.net
[root@wild-enthusiast ~]# vi a.pp
[root@wild-enthusiast ~]# cat a.pp 
package { 'uuid-gem':
  ensure => present,
  name => 'uuid',
  provider => 'gem'
}
 
package { 'uuid-yum':
  ensure => present,
  name => 'uuid',
  provider => 'yum'
}
[root@wild-enthusiast ~]# puppet apply a.pp
Notice: Compiled catalog for wild-enthusiast.delivery.puppetlabs.net in environment production in 0.27 seconds
Notice: /Stage[main]/Main/Package[uuid-gem]/ensure: created
Notice: /Stage[main]/Main/Package[uuid-yum]/ensure: created
Notice: Applied catalog in 5.30 seconds

I'm going to close this as a dup of those.

This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages