Hi, all

I have some questions about the execution sequence in puppet.

*The background:*
  I want to install mysql package and configure /etc/my.cnf according to 
the version of mysql. So I wrote an user defined function to get mysql rpm 
version. Codes are as follows.
 ------------------------------------------------
  class mysql {
    package { 'mysql':
      ensure => latest,
    }

    $mysql_version = get_pkg_version("mysql")

    file { '/etc/my.cnf':
        ensure => present,
        mode    => '0644',
        content => template('mysql/mysql.cnf'),
        require => Package['mysql'],
     }
  }

  Note: get_pkg_version is the user defined function to get mysql rpm 
version.
-------------------------------------------------------------------------------------------
*Issue:*
   The first time I execute *puppet agent -t*, the variable 
*mysql_version*couldn't get the version of mysql. And I found it was executed 
before the 
installation of mysql package. And the second time I execute *puppet agent 
-t*, the variable *mysql_version* got the version of mysql installed after 
the first time.

So, my question is that are variables assignment executed before the 
resources such as Package, Service, File..etc? 
Is there any method can make *$mysql_version = get_pkg_version("mysql") 
*executed 
after *Package['mysql']*?

Really looking forward to your answers!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/6NzlmgjiBHUJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to