summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasiliy Tolstov <v.tolstov@selfip.ru>2014-06-14 00:26:00 +0400
committerVasiliy Tolstov <v.tolstov@selfip.ru>2014-06-14 00:26:00 +0400
commit9b42afd47701bb8a4c59f1a10ea648cd0640da3f (patch)
tree09b81c588d652a64bfb7bf2d4b9a613fbb1131bb
parentb241d916cfb3b4ef5348600fe3005da6b719f852 (diff)
downloadchef-9b42afd47701bb8a4c59f1a10ea648cd0640da3f.tar.gz
fix parse of packege/version/repo
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
-rw-r--r--lib/chef/provider/package/paludis.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/chef/provider/package/paludis.rb b/lib/chef/provider/package/paludis.rb
index c69ba5cabb..aa02eec203 100644
--- a/lib/chef/provider/package/paludis.rb
+++ b/lib/chef/provider/package/paludis.rb
@@ -36,17 +36,21 @@ class Chef
Chef::Log.debug("Checking package status for #{@new_resource.package_name}")
installed = false
+ re = Regexp.new('(?<name>(.*))[[:blank:]](?<version>(.*))[[:blank:]](?<repository>(.*))$')
shell_out!("cave -L warning print-ids -m \"#{@new_resource.package_name}\" -f \"%c/%p %v %r\n\"").stdout.each_line do |line|
- case line
- when /accounts/
+ res = re.match(line)
+ case res[:repository]
+ when 'accounts', 'installed-accounts'
next
- when /(.*)\s+(.*)\s+(.*)\sinstalled/
- installed = true
- @current_resource.version($2)
- else
- @candidate_version = $2
- @current_resource.version(nil)
+ when 'installed'
+ if res[:repository] == 'installed'
+ installed = true
+ @current_resource.version(res[:version])
+ else
+ @candidate_version = res[:version]
+ @current_resource.version(nil)
+ end
end
end