Fix remove_warnings

Method lib/puppet/provider/keystone.rb/self.remove_providers does not
support multi line warnings and client results having more than one
column. This patch is fixing it (not sure how module can work with such
bug before anyway).

Change-Id: I19c3ce68ef786a2641d1e2808cb4db9979bdcfed
This commit is contained in:
Martin Magr
2013-10-24 17:17:46 +02:00
parent 27005c74d9
commit e100e057bb

View File

@@ -168,12 +168,16 @@ class Puppet::Provider::Keystone < Puppet::Provider
# I refactor things to use the the rest API
def self.remove_warnings(results)
found_header = false
in_warning = false
results.split("\n").collect do |line|
unless found_header
if line =~ /^\+-+\+-+\+$/
if line =~ /^\+[-\+]+\+$/
in_warning = false
found_header = true
line
elsif line =~ /^WARNING/
elsif line =~ /^WARNING/ or line =~ /UserWarning/ or in_warning
# warnings can be multi line, we have to skip all of them
in_warning = true
nil
else
line