Ask Your Question

Detect package version change ?

asked 2015-02-09 14:10:18 -0600

updated 2015-04-04 19:24:00 -0600

ramindk gravatar image

Is there a way for a puppet agent run to "know" that the version of a package has changed ?

If the version update is done in the run, you can get a notify event from the package resource.

My use-case is when the update is done outside of Puppet.

The package in question is the mysql family. When the version of the software changes, you probably need to run "mysql_upgrade" to upgrade the database system tables.

edit retag flag offensive close merge delete



adding it in facter should do the trick

simonrondelez gravatar imagesimonrondelez ( 2015-02-11 09:35:03 -0600 )edit

The problem is that I need to know the version of the package from two different states.
I could do something kloooodjy like output the version to a text file and then read it back and compare it, but I was hoping for a more elegant solution.

LinuxDan gravatar imageLinuxDan ( 2015-02-11 11:28:55 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-04-04 11:40:17 -0600

updated 2015-04-04 11:41:45 -0600

You're looking for the meta-attribute “audit”.

package { 'my_sql_database':
  ensure => present,
  name   => 'mysqld',
  audit  => 'ensure',

Package['my_sql_database'] ~> Exec['mysql_upgrade']

exec { 'mysql_upgrade':
  command     => '/usr/bin/mysql_upgrade -y',
  refreshonly => true,

PS: OK, this doesn't let you know, which version puppet previously recorded and what version it is now.

edit flag offensive delete link more

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: 2015-02-09 14:10:18 -0600

Seen: 532 times

Last updated: Apr 04 '15