Puppet: System Administration Automated

Support

Ticket #1001 (closed defect: fixed)

Opened 9 months ago

Last modified 8 months ago

OpenBSD package provider fails with dashes in package name -> always reinstalling the package

Reported by: immerda Assigned to: luke
Priority: normal Milestone: 0.24.2
Component: library Version: 0.24.1
Severity: normal Keywords: package, provider, openbsd
Cc: Triage Stage: Ready for checkin
Attached Patches: Code Complexity: Trivial

Description

Several package definitions like:

package { 'bash':
   ensure => 'present',
   source => 'ftp://mirror.switch.ch/pub/OpenBSD/4.2/packages/i386/bash-3.2.17.tgz',
   require => Package[gettext],
}

work perfectly. They get installed once and it's ok. However the definition:

package { 'vim':
   name => $operatingsystem ? {
       centos => vim-enhanced,
       default => vim,
   },
   category => $operatingsystem ? {
       gentoo => 'app-editors',
       default => '',
   },
   ensure => present,
   source => $operatingsystem ? {
       openbsd => 'ftp://mirror.switch.ch/pub/OpenBSD/4.2/packages/i386/vim-7.1.33-no_x11.tgz',
       default => undef,
   },
}

works as well, but it gets reinstalled and reinstalled over and over again, by every puppetd run on an openbsd machine. All other systems (linux distros) work perfectly. I think it's due to the second dash "-" in the package-name. As "pkg_info -a"-output parsing in the parser won't match with the package name, as well the "/usr/sbin/pkg_info vim" won't match.

$ pkg_info -a
bash-3.2.17         GNU Bourne Again Shell
gettext-0.14.6p0    GNU gettext
libiconv-1.9.2p3    character set conversion library
ntp-4.2.0ap3        network time protocol implementation
ruby-1.8.5p7        object oriented script language with threads
screen-4.0.3p0      multi-screen window manager
vim-7.1.33-no_x11   vi clone, many additional features

Debug output from a run:

debug: package provider openbsd: Executing '/usr/sbin/pkg_info vim'
debug: //default/immerda_default/base/vim/Package[vim]: Changing ensure
debug: //default/immerda_default/base/vim/Package[vim]: 1 change(s)
debug: //default/immerda_default/base/vim/Package[vim]/ensure: setting present (currently absent)
debug: package provider openbsd: Executing '/usr/sbin/pkg_add ftp://mirror.switch.ch/pub/OpenBSD/4.2/packages/i386/vim-7.1.33-no_x11.tgz'
notice: //default/immerda_default/base/vim/Package[vim]/ensure: created

Attachments

openbsd_provider-pkg_info-output.patch (429 bytes) - added by immerda on 01/11/08 11:13:09.
patch to fix

Change History

01/11/08 10:53:45 changed by immerda

  • version changed from 0.23.2 to 0.24.1.

It rather looks like the Output of pkg_info output have changed from OpenBSD 4.1 to 4.2 so the parsing of the output doesn't fit anymore:

4.1:

$ pkg_info vim 
Information for vim-7.0.178p0-no_x11
[...]

4.2:

$ pkg_info vim 
Information for inst:vim-7.0.178p0-no_x11
[...]

So the following (and attached patch) should fix this behaviour. Unfortunately I couldn't test it on any system < 4.2 (I just start with puppet from 4.2 on), but it fixed the wrong behaviour on 4.2:

--- provider/package/openbsd.rb.old     Fri Jan 11 10:37:07 2008
+++ provider/package/openbsd.rb Fri Jan 11 10:38:24 2008
@@ -66,7 +66,7 @@
         info = pkginfo @resource[:name]

         # Search for the version info
-        if info =~ /Information for #{@resource[:name]}-(\S+)/
+        if info =~ /Information for (inst:)?#{@resource[:name]}-(\S+)/
             hash[:ensure] = $1
         else
             return nil

According to the latest source this haven't been fixed in 0.24.1 so changing the version as well.

01/11/08 11:13:09 changed by immerda

  • attachment openbsd_provider-pkg_info-output.patch added.

patch to fix

01/28/08 04:47:08 changed by luke

  • patch changed from None to Code.
  • stage changed from Unreviewed to Accepted.
  • milestone set to 0.24.2.

01/28/08 04:47:17 changed by luke

  • stage changed from Accepted to Ready for checkin.

01/28/08 12:58:57 changed by jamtur01

  • owner changed from community to luke.
  • complexity changed from Unknown to Trivial.

Fixed in commit [11799b3266674edf5eba3591dcb41eae51c1a0e4] in branch 0.24.x

02/05/08 07:02:49 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Pushed.