On 09/13/2010 09:59 AM, Russell Jackson wrote: > On 09/12/2010 07:32 AM, FreddieB wrote: >> I looks like Puppet is not able to figure out that MySQL 5.1 is >> already installed. If I list the packages installed (with pkg_info) I >> find MySQL there but it's not called "mysql51-server" but "mysql- >> server-5.1.48". If I go back to my init.pp and change the name from >> "mysql51-server" to just "mysql-server", it works again (i.e. it will >> not try to install the package again). It is not possible to start >> with just "mysql-server", because there is no package called just >> "mysql-server". >> >> My conclusion is that FreeBSD's inconsistent way of naming the >> packages fools Puppet to think it's not installed. I've never written >> a line of ruby-code so I could use some help here. Can anyone think of >> a good workaround? >> >> BTW - my current, and not so pretty workaround is to link mysql- >> server.tbz to mysql51-server.tbz on my local FreeBSD-mirror-site. >> > > Yes. The package system has turned out to be a royal PITA for puppet. I > don't have any good work-a-rounds at the moment. I think we might be > able to do something by specifying the package name as the port origin > (pkg_info -o) and looking up the right package out of ports/INDEX. >
I imagine it could work something like this: # Download the ports index mkdir /tmp/ports-index cd /tmp/ports-index fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.1-release/INDEX.bz2 bunzip2 INDEX # Lookup package name from origin path pkgname=$(awk -F\| '{ if ($2 == "/usr/ports/databases/mysql51-server") print $1 }' INDEX) pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.1-release/All/${pkgname}.tbz Checking if the package was installed could be done with pkg_info -O: pkg_info -O databases/mysql51-server | tail -n+2 | grep -qc '$' && echo 'installed' || echo 'not installed' Then the resource definition would look like this: package { "mysql-server": name => $operatingsystem ? { FreeBSD => "databases/mysql51-server", default => "mysql-server", }, ensure => installed, } -- Russell A Jackson <r...@csub.edu> Network Analyst California State University, Bakersfield -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@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.