Bug 758687 - Wild char '&' in template will cause XML parse error
Summary: Wild char '&' in template will cause XML parse error
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: imagefactory
Version: 1.0.0
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
Assignee: Ian McLeod
QA Contact: Martin Kočí
URL:
Whiteboard: HUDSONdone=bug758687.py
Depends On:
Blocks: ce-sprint
TreeView+ depends on / blocked
 
Reported: 2011-11-30 12:54 UTC by Martin Kočí
Modified: 2012-01-05 19:20 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-05 19:20:12 UTC


Attachments (Terms of Use)

Description Martin Kočí 2011-11-30 12:54:26 UTC
Description of problem:
If you try to build an image from command line using imagefactory and xml template with wild char '&' in raw type will cause xml parse error. 

Version-Release number of selected component (if applicable):
imagefactory-0.8.9-1.fc15.noarch
oz-0.7.9-3.fc15.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create template with wild char '&' in raw type (or see attached example)
2. run #sudo imagefactory --debug --target rhevm --template /path/to/template.tdl

  
Actual results:
2011-11-30 13:47:16,814 DEBUG imgfac.ImageWarehouse.ImageWarehouse pid(17106) Message: Created Image Warehouse instance http://localhost:9090 - buckets(target_images, templates, icicles, provider_images)
2011-11-30 13:47:16,815 DEBUG imgfac.ImageWarehouse.ImageWarehouse pid(17106) Message: Created Image Warehouse instance http://localhost:9090 - buckets(target_images, templates, icicles, provider_images)
Entity: line 18: parser error : xmlParseEntityRef: no name
      Aeolus Cloud Test page on Build Created for Mumbai & Westford  Private RHE
                                                          ^
Traceback (most recent call last):
  File "/usr/bin/imagefactory", line 224, in <module>
    sys.exit(Application().main())
  File "/usr/bin/imagefactory", line 203, in main
    dispatchers = BuildDispatcher().build_image_for_targets(self.app_config['image'], None, self.app_config['template'], self.app_config['target'])
  File "/usr/lib/python2.7/site-packages/imgfac/BuildDispatcher.py", line 54, in build_image_for_targets
    image_id = self._ensure_image_with_template(image_id, template)
  File "/usr/lib/python2.7/site-packages/imgfac/BuildDispatcher.py", line 133, in _ensure_image_with_template
    name = self._xml_node(template.xml, '/template/name')
  File "/usr/lib/python2.7/site-packages/imgfac/BuildDispatcher.py", line 126, in _xml_node
    nodes = libxml2.parseDoc(xml).xpathEval(xpath)
  File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1263, in parseDoc
    if ret is None:raise parserError('xmlParseDoc() failed')
libxml2.parserError: xmlParseDoc() failed


Expected results:
No xml parse error

Comment 1 wes hayutin 2012-01-03 17:41:55 UTC
adding ce-sprint-next bugs to ce-sprint

Comment 2 Ian McLeod 2012-01-05 19:20:12 UTC
TDL is an XML document standard.

A naked ampersand is not valid in XML.  It must be escaped as:

&amp;

See:

http://www.xml.com/pub/a/2001/01/31/qanda.html

Closing as NOTABUG


Note You need to log in before you can comment on or make changes to this bug.