Ask Your Question

Ensuring RPM package version

asked 2017-03-27 02:35:46 -0500

nitins gravatar image

updated 2017-03-30 01:36:50 -0500

I am trying to ensure a certain version of package which I have built to be installed. The variable mypkgversion is from hiera

 package { 'my_package_name':
    ensure      => $my_pkg_version,
    notify      => Service['service_name']

However the package is not getting upgraded when I put the new version in hiera and in yum repo. When I build a new system I am getting the version of package defined in hiera. But for already existing system with the package installed, it's not getting upgraded to the version.

I am putting the version in the format 1.0.0-6 . This is RHEL 7 system.

I ran the query rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' as suggested by Eric. The output: my_package_name-1.0.0-6.

As mentioned earlier my issue is with upgrades. Whenever a new system is provisioned I am getting the correct RPM version installed.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-27 06:13:48 -0500

puser gravatar image

Version numbers must match the full version to install, including release if the provider uses a release moniker. Ranges or semver patterns are not accepted except for the gem package provider. For example, to install the bash package from the rpm bash-4.1.2-29.el6.x86_64.rpm, use the string '4.1.2-29.el6'.

edit flag offensive delete link more


What if my package doesn't have .el6 part? say bash-4.1.2-29.x86_64.rpm

nitins gravatar imagenitins ( 2017-03-27 06:18:54 -0500 )edit

Run this rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' bash It will show you the version and then you can use this to help you figure out which versions to ensure.

puser gravatar imagepuser ( 2017-03-27 06:25:17 -0500 )edit

Ran the query, output is my_package_name-1.0.0-6 which is as I have provided in hiera. Updating the question with your query out

nitins gravatar imagenitins ( 2017-03-27 10:47:52 -0500 )edit

so in hiera you have 1.0.0-6 and later you specify another version in the same format and the package is not upgrading?

puser gravatar imagepuser ( 2017-03-27 12:17:54 -0500 )edit

Yes. But if I spinup a new machine it gets the version provided in hiera

nitins gravatar imagenitins ( 2017-03-28 00:13:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-03-27 02:35:46 -0500

Seen: 62 times

Last updated: Mar 30