Properly sanitize murano package-list output before using it
In some cases, the murano package-list output may include a warning [1], and that confuses the provider. We need to sanitize the output before using it. This time, we are using the right syntax for the new method. [1] - https://review.rdoproject.org/etherpad/p/murano-failure, seen with urllib3 1.21.1 Change-Id: I01f750908540e5036e46a31bfaf49e655c8f37ca
This commit is contained in:
parent
1ad4fd2bda
commit
6ab2fdc826
@ -12,8 +12,19 @@ Puppet::Type.type(:murano_application).provide(
|
||||
|
||||
mk_resource_methods
|
||||
|
||||
def self.package_list_cleanup(text)
|
||||
return nil if text.nil?
|
||||
# The murano package-list valid output should only start by + or |
|
||||
text=text.split("\n").drop_while { |line| line !~ /^(\+|\|)/ }.join("\n")
|
||||
"#{text}\n"
|
||||
end
|
||||
|
||||
def package_list_cleanup(text)
|
||||
self.class.package_list_cleanup(text)
|
||||
end
|
||||
|
||||
def exists?
|
||||
packages = auth_murano('package-list')
|
||||
packages = package_list_cleanup(auth_murano('package-list'))
|
||||
return packages.split("\n")[1..-1].detect do |n|
|
||||
n =~ /\s(#{resource[:name]})\s/
|
||||
end
|
||||
@ -34,7 +45,7 @@ Puppet::Type.type(:murano_application).provide(
|
||||
end
|
||||
|
||||
def self.instances
|
||||
packages = auth_murano('package-list')
|
||||
packages = package_list_cleanup(auth_murano('package-list'))
|
||||
packages.split("\n")[3..-2].collect do |n|
|
||||
new({
|
||||
:name => n.split("|")[3][/([^\s]+)/],
|
||||
|
Loading…
x
Reference in New Issue
Block a user