mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-19 06:50:07 +03:00
bug: Templates are now render in ASCI strings without syntax errors (for update methods)
This commit is contained in:
parent
2f28688725
commit
75bcc46dd7
@ -214,14 +214,15 @@ module OpenNebula
|
||||
|
||||
str_line << n.collect {|n2|
|
||||
if n2 && n2.class==REXML::Element
|
||||
str = ind_tab + n2.name + "="
|
||||
str += n2.text if n2.text
|
||||
str = ""
|
||||
str << ind_tab << n2.name << '='
|
||||
str << attr_to_str(n2.text) if n2.text
|
||||
str
|
||||
end
|
||||
}.compact.join(","+ind_enter)
|
||||
}.compact.join(','+ind_enter)
|
||||
str_line<<" ]"
|
||||
else
|
||||
str_line<<n.name << "=" << n.text.to_s
|
||||
str_line << n.name << '=' << attr_to_str(n.text.to_s)
|
||||
end
|
||||
str_line
|
||||
end
|
||||
@ -284,6 +285,17 @@ module OpenNebula
|
||||
|
||||
hash
|
||||
end
|
||||
|
||||
private
|
||||
def attr_to_str(attr)
|
||||
attr.gsub!('"',"\\\"")
|
||||
|
||||
if attr.match(/[=,' ']/)
|
||||
return '"' + attr + '"'
|
||||
end
|
||||
|
||||
return attr
|
||||
end
|
||||
end
|
||||
|
||||
###########################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user