On Wednesday, April 23, 2014 4:12:15 PM UTC-5, Jakov Sosic wrote: > > On 04/23/2014 10:57 PM, Jon Forrest wrote: > > 3) Just presume that MySQL won't be installed in the first place. > > I could do this but I'd like my modules to be more accepting and > > not require a specially prepared system. > > > > Any suggestions? > > You're trying to circuvment the package management problem.
I think he's writing very natural and reasonable declarations to express what he's after. The problem is that there's a bit of a mismatch between Puppet and yum with respect to identifying packages. Yum primarily identifies packages by their names, but it can also identify packages by the features they provide. Jon recognizes this. > I would > suggest you to write custom fact that would check if mysql is installed, > and only then apply ensure => absent for package 'mysql'. > > Something along these lines: > > Facter.add("mysql_installed") do > setcode do > rpm_mysql = Facter::Util::Resolution.exec('/bin/rpm -qa mysql') > if $rpm_mysql != '' > false > else > true > end > end > end > > > if ( $::mysql_installed ) { > package { 'mysql': ensure => purged } > } > For what it's worth, Puppet probably would not exhibit this problem if it were ensuring 'absent' and package mysql was indeed initially absent. Puppet knows that it doesn't need to act in that case. Purging is an issue, however, because with some other packaging systems it is possible for a package to be absent but not purged. The general Package provider infrastructure therefore attempts to purge packages even if they are not installed, and the yum provider does not override that behavior (though it could and should). Feel free to vote up the relevant bug report: https://tickets.puppetlabs.com/browse/PUP-1198. Anyway, a custom fact may indeed yield the best workaround. If it is possible for mysql and percona-client to be installed at the same time, however, then something a bit more involved may be required, because in that case ensuring mysql purged likely removes percona-client as well. Worse, because percona-client was installed at the beginning of the Puppet run, Puppet will not even realize that it needs to be reinstalled. (Score another raspberry for 'purged'.) Ideally, then, it would be best if the percona-client package precluded concurrent installation with mysql. It may be that a suitable Conflicts: header would serve that purpose, though I'm not sure whether a package is installable or updatable if it conflicts with a feature that it provides itself. An Obsoletes: header might be better suited to the job, but I'm unsure offhand whether it would reliably prevent concurrent installation of the obsoleted RPM. There might be other, worse alternatives if none of that works out. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ebc8e390-fcfa-4634-ba82-4ccf9d38aea7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.