Opened 12 years ago
Closed 12 years ago
#64 closed (fixed)
Resource.description is an optional parameter, but Resource.toXML() fails if it is not set
Reported by: | chaos@bbn.com | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | 2012-09-04 client release |
Component: | Clients | Version: | |
Keywords: | v0.4.0 | Cc: | |
Dependencies: |
Description
I tested with this modified gmoc.py snippet, which tries to pretty-print a resource's XML after creating it:
1663 # add resource nodes 1664 for res in resources.values(): 1665 node = res.toXML(doc, root) 1666 print node.toprettyxml()
With this, the code:
... resource[datapath] = gmoc.Resource( resource_urn, type = 'datapath', pop = pop, operator = organization, description = '' ) ... data.store(pop)
yields:
<resource aggregate="foam5.gpolab.bbn.com" description="" name="urn:publicid:IDN+openflow:foam:foam5.gpolab.bbn.com+datapath+04:4d:00:12:e2:b8:a5:d0" organization="urn:publicid:IDN+gmoc.geni.net+organization+BBN" pop="gpolab" type="datapath"/>
whereas the code:
... resource[datapath] = gmoc.Resource( resource_urn, type = 'datapath', pop = pop, operator = organization, ) ... data.store(pop)
yields:
Traceback (most recent call last): File "./report_foam_relations", line 336, in <module> data.store(pop) File "/home/chaos/gmoc.py", line 1666, in store print node.toprettyxml() File "/usr/lib/python2.6/xml/dom/minidom.py", line 59, in toprettyxml self.writexml(writer, "", indent, newl) File "/usr/lib/python2.6/xml/dom/minidom.py", line 812, in writexml _write_data(writer, attrs[a_name].value) File "/usr/lib/python2.6/xml/dom/minidom.py", line 301, in _write_data data = data.replace("&", "&").replace("<", "<") AttributeError: 'NoneType' object has no attribute 'replace'
Either description should be a mandatory attribute of gmoc.Resource
, or Resource.toXML()
should not blow up when it is omitted.
Note: See
TracTickets for help on using
tickets.
This is fixed in v0.5.0.