[generateDS] too many values to unpack

Bug #1665614 reported by Michał Kostrzewa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
Trunk
Fix Committed
Undecided
Michał Kostrzewa

Bug Description

Trying to use generateDS to generate golang API results in the following traceback:

root@dpdk-builder:~/contrail-generateDS# ./generateDS.py -f -o ~/output -g golang-api /opt/contrail/controller/src/schema/vnc_cfg.xsd
WARNING:ifmap_model:route-target not found in xml schema
WARNING:ifmap_model:bgp-router not found in xml schema
WARNING:ifmap_model:routing-policy not found in xml schema
WARNING:ifmap_model:customer-attachment not found in xml schema
WARNING:ifmap_model:provider-attachment not found in xml schema
WARNING:ifmap_model:routing-instance not found in xml schema
WARNING:ifmap_model:route-aggregate not found in xml schema
<type 'exceptions.ValueError'>
Python 2.7.12: /usr/bin/python
Fri Feb 17 12:32:11 2017

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /root/contrail-generateDS/generateDS.py in <module>()
 5693 cgitb.enable(format='text')
 5694 logging.basicConfig(level=logging.WARN,)
 5695 main()
 5696
 5697
main = <function main>

 /root/contrail-generateDS/generateDS.py in main()
 5682 #LG LangGenr = CppGenerator()
 5683
 5684 pgenr.parseAndGenerate()
 5685 #LG parseAndGenerate(outFilename, subclassFilename, prefix,
 5686 #LG xschemaFileName, behaviorFilename,
pgenr = <__main__.XsdParserGenerator object>
pgenr.parseAndGenerate = <bound method XsdParserGenerator.parseAndGenerate of <__main__.XsdParserGenerator object>>

 /root/contrail-generateDS/generateDS.py in parseAndGenerate(self=<__main__.XsdParserGenerator object>)
 1137 #debug_show_elements(root)
 1138 infile.seek(0)
 1139 self._Generator.generate(root, infile, self.outFilename)
 1140
 1141 #LG #
self = <__main__.XsdParserGenerator object>
self._Generator = <ccmap.IFMapGenerator object>
self._Generator.generate = <bound method IFMapGenerator.generate of <ccmap.IFMapGenerator object>>
root = <XschemaElement name: "" type: "xsd:string">
infile = <StringIO.StringIO instance>
self.outFilename = '/root/output'

 /root/contrail-generateDS/ccmap.py in generate(self=<ccmap.IFMapGenerator object>, root=<XschemaElement name: "" type: "xsd:string">, infile=<StringIO.StringIO instance>, outFilename='/root/output')
  199 self._GenerateDeviceApi(root)
  200 elif self._genCategory == 'golang-api':
  201 self._GenerateGoLangApi(root)
  202 elif self._genCategory == 'json-schema':
  203 self._GenerateJsonSchema(root)
self = <ccmap.IFMapGenerator object>
self._GenerateGoLangApi = <bound method IFMapGenerator._GenerateGoLangApi of <ccmap.IFMapGenerator object>>
root = <XschemaElement name: "" type: "xsd:string">

 /root/contrail-generateDS/ccmap.py in _GenerateGoLangApi(self=<ccmap.IFMapGenerator object>, xsd_root=<XschemaElement name: "" type: "xsd:string">)
  172 apigen = GoLangApiGenerator(self._Parser, self._cTypesDict,
  173 self._Identifiers, self._Metadata)
  174 apigen.Generate(self._Parser.outFilename)
  175
  176 def _GenerateJsonSchema(self, xsd_root):
apigen = <golang_api.GoLangApiGenerator object>
apigen.Generate = <bound method GoLangApiGenerator.Generate of <golang_api.GoLangApiGenerator object>>
self = <ccmap.IFMapGenerator object>
self._Parser = <__main__.XsdParserGenerator object>
self._Parser.outFilename = '/root/output'

 /root/contrail-generateDS/golang_api.py in Generate(self=<golang_api.GoLangApiGenerator object>, dirname='/root/output')
  822 filename = os.path.join(
  823 dirname, ident.getCIdentifierName() + ".go")
  824 self._GenerateObject(ident, filename)
  825
  826 self._PromoteInnerTypes()
self = <golang_api.GoLangApiGenerator object>
self._GenerateObject = <bound method GoLangApiGenerator._GenerateObject of <golang_api.GoLangApiGenerator object>>
ident = <ifmap_model.IFMapIdentifier object>
filename = u'/root/output/domain.go'

 /root/contrail-generateDS/golang_api.py in _GenerateObject(self=<golang_api.GoLangApiGenerator object>, ident=<ifmap_model.IFMapIdentifier object>, filename=u'/root/output/domain.go')
   70 self._GenerateConstFlags(ident, file)
   71 self._GenerateObjectStruct(ident, file)
   72 self._GenerateGenericMethods(ident, file)
   73 self._GeneratePropertyMethods(ident, file)
   74 self._GenerateChildrenMethods(ident, file)
self = <golang_api.GoLangApiGenerator object>
self._GenerateGenericMethods = <bound method GoLangApiGenerator._GenerateGenericMethods of <golang_api.GoLangApiGenerator object>>
ident = <ifmap_model.IFMapIdentifier object>
file = <open file u'/root/output/domain.go', mode 'w'>

 /root/contrail-generateDS/golang_api.py in _GenerateGenericMethods(self=<golang_api.GoLangApiGenerator object>, ident=<ifmap_model.IFMapIdentifier object>, file=<open file u'/root/output/domain.go', mode 'w'>)
  284 parents = ident.getParents()
  285 if parents:
  286 (parent, meta) = parents[0]
  287 quoted_list = map(lambda x: '"%s"' % x, parent.getDefaultFQName())
  288 parent_fqn = ', '.join(quoted_list)
parent undefined
meta undefined
parents = [(<ifmap_model.IFMapIdentifier object>, <ifmap_model.IFMapLink object>, False)]
<type 'exceptions.ValueError'>: too many values to unpack
    __class__ = <type 'exceptions.ValueError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.ValueError object>
    __dict__ = {}
    __doc__ = 'Inappropriate argument value (of correct type).'
    __format__ = <built-in method __format__ of exceptions.ValueError object>
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.ValueError object>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.ValueError object>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.ValueError object>
    __hash__ = <method-wrapper '__hash__' of exceptions.ValueError object>
    __init__ = <method-wrapper '__init__' of exceptions.ValueError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of exceptions.ValueError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.ValueError object>
    __repr__ = <method-wrapper '__repr__' of exceptions.ValueError object>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.ValueError object>
    __setstate__ = <built-in method __setstate__ of exceptions.ValueError object>
    __sizeof__ = <built-in method __sizeof__ of exceptions.ValueError object>
    __str__ = <method-wrapper '__str__' of exceptions.ValueError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of exceptions.ValueError object>
    args = ('too many values to unpack',)
    message = 'too many values to unpack'

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
  File "./generateDS.py", line 5695, in <module>
    main()
  File "./generateDS.py", line 5684, in main
    pgenr.parseAndGenerate()
  File "./generateDS.py", line 1139, in parseAndGenerate
    self._Generator.generate(root, infile, self.outFilename)
  File "/root/contrail-generateDS/ccmap.py", line 201, in generate
    self._GenerateGoLangApi(root)
  File "/root/contrail-generateDS/ccmap.py", line 174, in _GenerateGoLangApi
    apigen.Generate(self._Parser.outFilename)
  File "/root/contrail-generateDS/golang_api.py", line 824, in Generate
    self._GenerateObject(ident, filename)
  File "/root/contrail-generateDS/golang_api.py", line 72, in _GenerateObject
    self._GenerateGenericMethods(ident, file)
  File "/root/contrail-generateDS/golang_api.py", line 286, in _GenerateGenericMethods
    (parent, meta) = parents[0]
ValueError: too many values to unpack

Git commits:
contrail-generateDS 08bfd5e685f04ed90229d91b1b48a36a7ecbff16
contrail-controller d8917495817dea4cf05dc478cd6312bd7597e2af

information type: Proprietary → Public
Changed in juniperopenstack:
assignee: nobody → Michał Kostrzewa (mkostrzewa)
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/28890
Submitter: Micha? Kostrzewa (<email address hidden>)

Jeba Paulaiyan (jebap)
tags: added: contrail-control
Revision history for this message
Prakash Bailkeri (prakashmb) wrote :
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/28890
Submitter: Micha? Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/28890
Committed: http://github.org/Juniper/contrail-generateDS/commit/0141e842ac555cda6bef0176ee4659eb670dd055
Submitter: Zuul (<email address hidden>)
Branch: master

commit 0141e842ac555cda6bef0176ee4659eb670dd055
Author: m-kostrzewa <email address hidden>
Date: Fri Feb 17 12:45:02 2017 +0100

Fixes 'too many values to unpack' exceptoin

Change-Id: Ib8c74f2c920b61907766636c26b3508667b95cdd
closes-bug: #1665614

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.