On 5/13/2009 4:10 PM, Jeremy Thurgood wrote: > The problem is that the provider suitability resolution happens before > any of the ordering. Consider the following simplified class: > > class mysql { > package { "mysql-client": ensure => installed } > package { "mysql-server": ensure => installed } > mysql_user { "u...@localhost": > password_hash => "hashed password", > require => [Package["mysql-server"], Package["mysql-client"]], > } > } > > One would expect the two packages would be installed and then the new > db user to be created. However, the mysql_user provider needs > /usr/bin/mysql to be present. Since it isn't (because mysql isn't > installed yet), no suitable providers are found and the run fails > immediately.
I may be naive here, since I've never written my own types, but I'm wondering if a puppet definition for mysql_user would be better than writing a native puppet type. Something like: mysql_user { "u...@localhost": password_hash => "hashed password" } with: define mysql_user ( $password_hash = "someknownhash" ) { exec { "create_$name": command => "mysql -e 'CREATE USER $name IDENTIFIED BY PASSWORD $password_hash'", require => [Package["mysql-server"], Package["mysql-client"]], } } The types I see on the documentation pages all appear to be written in straight Ruby, and don't rely on external programs to run. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. 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 -~----------~----~----~----~------~----~------~--~---