Fix the issue to unescape unneed characters in image property

Currently, powervc driver image sync service will sync the powervc image
meta properties to hosting openstack side, it's using
HTMLParser.unescape() to unescape the escape chars. It's over used, only
"<", and ">" that corresponding escpae char is "&lt;" & "&gt;" is needed
to be unescaped. Fix this only to unescape this two chars.

Closes-Bug: #1362886
Change-Id: I11db0cab46c8707a6c306f9967d7afc08fbad3ec
This commit is contained in:
Terry Yao 2014-08-29 09:56:20 +08:00 committed by Le Tian Ren
parent 56113cd808
commit 4d7fc1ad44
1 changed files with 3 additions and 1 deletions

View File

@ -3657,7 +3657,9 @@ class PowerVCImageManager(service.Service):
if props is not None:
for key in props.keys():
if key in constants.IMAGE_UNESCAPE_PROPERTIES:
props[key] = HTMLParser.HTMLParser().unescape(props[key])
if props[key]:
propVal = props[key].replace("&lt;", "<")
props[key] = propVal.replace("&gt;", ">")
def _get_image_properties(self, v1image_dict, default_props=None):
"""