Joseph, See https://tickets.puppetlabs.com/browse/PUP-682
I'm going to try and get the pull request rebased, but at best this will be in puppet4.
-Jason On 06/12/2014 02:44 PM, Joseph Swick wrote:
Hi list, I'm working on a little addition to an internal module we use to ensure our puppet clients have a consistent configuration to also ensure the correct version of puppet is installed on the system and run into a bit of semantics issue as I thought that "ensure => 'version.num'" was a more correct way of specifying the version of a package, rather than doing it in the name of the resource. Here's a few snippets of code: Common class opening: class puppet_mw::client ( ... $manage_versions = true, $puppet_version = '3.6.2', $facter_version = '2.0.2', $hiera_version = '1.3.4', ... ) { This works: if $manage_versions { package { "puppet-${puppet_version}": ensure => present, } package { "facter-${facter_version}": ensure => present, } package { "hiera-${hiera_version}": ensure => present, } } This however, does not: if $manage_versions { package { 'puppet': ensure => ${puppet_version}, } package { 'facter': ensure => ${facter_version}, } package { 'hiera': ensure => ${hiera_version}, } } As it generates this error: Error: Could not update: Failed to update to version 3.6.2, got version 3.6.2-1.el6 instead Wrapped exception: Failed to update to version 3.6.2, got version 3.6.2-1.el6 instead Error: /Stage[main]/Puppet_mw::Client/Package[puppet]/ensure: change from 3.6.2-1.el6 to 3.6.2 failed: Could not update: Failed to update to version 3.6.2, got version 3.6.2-1.el6 instead Error: Could not update: Failed to update to version 2.0.2, got version 2.0.2-1.el6 instead Wrapped exception: Failed to update to version 2.0.2, got version 2.0.2-1.el6 instead Error: /Stage[main]/Puppet_mw::Client/Package[facter]/ensure: change from 1.7.5-1.el6 to 2.0.2 failed: Could not update: Failed to update to version 2.0.2, got version 2.0.2-1.el6 instead Error: Could not update: Failed to update to version 1.3.4, got version 1.3.4-1.el6 instead Wrapped exception: Failed to update to version 1.3.4, got version 1.3.4-1.el6 instead Error: /Stage[main]/Puppet_mw::Client/Package[hiera]/ensure: change from 1.3.2-1.el6 to 1.3.4 failed: Could not update: Failed to update to version 1.3.4, got version 1.3.4-1.el6 instead Which lead me to this, but will get messy to ensure compatibility with different Linux versions: if $manage_versions { case $::osfamily { 'RedHat': { $os_string = "-1.el${::operatingsystemmajrelease}" } default : { $os_string = undef } } package { 'puppet': ensure => "${puppet_version}${os_string}", } package { 'facter': ensure => "${facter_version}${os_string}", } package { 'hiera': ensure => "${hiera_version}${os_string}", } } Running 'yum install puppet-3.6.2' works as desired, but adding 'allow_virutal => true,' to the package resource doesn't change the previous error. Is this working as designed for the Yum provider for the package resource or is this a bug with the provider? For some reason, I want to think this has been discussed on the list before, but couldn't find the relevant thread. It appears I may be running up against this bug: https://tickets.puppetlabs.com/browse/PUP-1244 TIA.
-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/53A02951.9030007%40jasonantman.com. For more options, visit https://groups.google.com/d/optout.