0

Tell me how to specify the correct version for the package to be installed. Updating Virtualbox. Updated normally. But, does it every time. Although, the latest version is already installed.

My manifest file:

class virtualbox {
        package { "virtualbox":
                provider => dpkg,
                ensure => '5.2.18-124319~Ubuntu~trusty',
                source => "/tmp/virtualbox-5.2_5.2.18-124319~Ubuntu~trusty_amd64.deb"
        }
}

On client:

$ sudo service puppet stop
 * Stopping puppet agent
$ sudo puppet agent -v --no-daemonize
Notice: Starting Puppet client version 3.4.3
Info: Retrieving plugin
Info: Caching catalog for w071
Error: Failed to apply catalog: Parameter ensure failed on Package[virtualbox]: Provider must have features 'versionable' to set 'ensure' to '5.2.18-124319~Ubuntu~trusty' at /etc/puppet/manifests/classes/1c_update.pp:7
Wrapped exception:
Provider must have features 'versionable' to set 'ensure' to '5.2.18-124319~Ubuntu~trusty'

If specify latest, the package will be updated every time.

Hanharr
  • 11
  • 2
  • So your issue is you want to use a specific version of virtualbox, and you can't specify an 'ensure' ("Provider must have features 'versionable'" and [the dpkg provider doesn't support versionable](https://puppet.com/docs/puppet/6.0/type.html#package-provider-dpkg)) but you're saying without it then the script reinstalls the package every time whether it needs to or not? (It ought not) – Rup Oct 12 '18 at 14:20
  • What's interesting, I can get the version: $ dpkg-deb --info /tmp/virtualbox-5.2_5.2.18-124319~Ubuntu~trusty_amd64.deb Package: virtualbox-5.2 Version: 5.2.18-124319~Ubuntu~trusty Architecture: amd64 Maintainer: Oracle Corporation Installed-Size: 175579 If I specify "ensure => latest," the package will be installed every time. It is not necessary. – Hanharr Oct 12 '18 at 14:28
  • 1
    @Rup You linked to a very recent 6.0 doc and @Hanharr is using a very obsolete 3.4.3 version. @Hanharr finding the version from the CLI does not equate to the dpkg provider having the `versionable` feature. – Matthew Schuchard Oct 12 '18 at 15:24
  • @MattSchuchard Fair enough I missed that, but that hasn't changed: dpkg wasn't versionable back then either. – Rup Oct 12 '18 at 15:39
  • @MattSchuchard Okay, thanks. But how can I update a package from dpkg only once? – Hanharr Oct 12 '18 at 18:00
  • @Hanharr The version is already specified in the source, so you just use `ensure => present` or `ensure => installed`. Either works. – Matthew Schuchard Oct 12 '18 at 18:12
  • @MattSchuchard If I write `ensure => installed`, it still installs every time. Don't know why. – Hanharr Oct 12 '18 at 21:01
  • Something else must be going on then. A system cannot repeatedly install the same version of the same software unless it failed to install, it was uninstalled, etc. – Matthew Schuchard Oct 12 '18 at 21:53
  • It may be useful to run `puppet resource package` on the target node to find out what packages and versions thereof Puppet *thinks* are installed already. – John Bollinger Oct 12 '18 at 23:41
  • By any chance, is the virtualbox package "held"? There were some issues surrounding that back in the Puppet3 days. – John Bollinger Oct 12 '18 at 23:53
  • @MattSchuchard This may be due to the fact that every time I run puppet agent -v --no-daemonize? The package is not "held". – Hanharr Oct 13 '18 at 17:16
  • @JohnBollinger I tried to install another package and everything worked as it should. Tell me if when you install .deb he needs to install dependencies, puppet throws an error. `sudo apt-get -f install` fixes the situation, but it needs to be done manually. Is there any way I can handle the errors? – Hanharr Oct 16 '18 at 13:16

0 Answers0