Package Resource, Versioning and Yum

69 views
Skip to first unread message

Joseph Swick

unread,
Jun 12, 2014, 2:44:36 PM6/12/14
to puppet...@googlegroups.com
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.

--
Joseph Swick <joseph...@meltwater.com>
Operations Engineer
Meltwater Group

signature.asc

Jason Antman

unread,
Jun 17, 2014, 7:41:21 AM6/17/14
to puppet...@googlegroups.com
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

Joseph Swick

unread,
Jun 17, 2014, 11:14:17 AM6/17/14
to puppet...@googlegroups.com
On 17/06/14 07:41, Jason Antman wrote:
> 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
>

Thank you, I had come across that bug report as well later on. I wasn't
sure originally if this was a known issue or not. We'll see what
presents Puppet 4 brings us.
signature.asc
Reply all
Reply to author
Forward
0 new messages