att-comdev / deckhand

This project has moved to OpenStack.
https://www.airshipit.org/
Apache License 2.0
9 stars 5 forks source link

parentSelector/labels must be provided even though document schema says otherwise #13

Open fmontei opened 6 years ago

fmontei commented 6 years ago

The parentSelector property in $.metadata.layeringDefinition and labels property in $.metadata for a document throw an AttributeError error if not provided for rendered-documents endpoint:

Traceback (most recent call last):
  File "/opt/stack/deckhand/.tox/functional/local/lib/python2.7/site-packages/falcon/api.py", line 242, in __call__
    responder(req, resp, **params)
  File "./deckhand/policy.py", line 104, in handler
    return func(*args, **kwargs)
  File "./deckhand/control/common.py", line 88, in wrapper
    return func(self, req, *func_args, **func_kwargs)
  File "./deckhand/control/revision_documents.py", line 117, in on_get
    documents)
  File "./deckhand/engine/layering.py", line 156, in __init__
    self.layered_docs = self._calc_document_children()
  File "./deckhand/engine/layering.py", line 113, in _calc_document_children
    children = _get_children(doc)
  File "./deckhand/engine/layering.py", line 98, in _get_children
    parent_sel_key = list(parent_sel.keys())[0]
AttributeError: 'NoneType' object has no attribute 'keys'

This inconsistency should be fixed.