diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-09 16:39:16 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-09 16:39:16 +0000 |
| commit | 710bf0dd8be6391c0cbb2885169677671ebfd351 (patch) | |
| tree | b763efb6a8acad2a027306eb2906e9b3eff58d1d | |
| parent | 9e77e7a95c1c59aca2e7599e0164aef8f3724bf2 (diff) | |
| download | puppet-710bf0dd8be6391c0cbb2885169677671ebfd351.tar.gz puppet-710bf0dd8be6391c0cbb2885169677671ebfd351.tar.xz puppet-710bf0dd8be6391c0cbb2885169677671ebfd351.zip | |
Slight modifications to package parsing on *bsd. It should be better about catching the version number, and unparseable lines are now just warnings, not errors.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1182 980ebf18-57e1-0310-9a29-db15c13687c0
| -rwxr-xr-x | lib/puppet/type/package/openbsd.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/puppet/type/package/openbsd.rb b/lib/puppet/type/package/openbsd.rb index 9feaa2feb..441ff83d2 100755 --- a/lib/puppet/type/package/openbsd.rb +++ b/lib/puppet/type/package/openbsd.rb @@ -55,8 +55,8 @@ module Puppet end # list out all of the packages open("| #{listcmd()}") { |process| - # our regex for matching dpkg output - regex = %r{^(\S+)-(\d\S*)\s+(.+)} + # our regex for matching pkg_info output + regex = %r{^(\S+)-([^-\s]+)\s+(.+)} fields = [:name, :version, :description] hash = {} @@ -82,13 +82,14 @@ module Puppet pkg = Puppet.type(:package).installedpkg(hash) packages << pkg else - raise Puppet::DevError, - "Failed to match line %s" % line + # Print a warning on lines we can't match, but move + # on, since it should be non-fatal + warning("Failed to match line %s" % line) end } } - # Mark any packages we didn't find as absent + # Mark as absent any packages we didn't find Puppet.type(:package).each do |pkg| unless packages.include? pkg pkg.is = [:ensure, :absent] |
