Ensemble hook api should have better error checking/validation of args

Bug #737121 reported by Kapil Thangavelu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyjuju
Fix Released
Undecided
Benjamin Saller

Bug Description

Clint posted an example on irc of a traceback he got from a hook..

2011-03-17 20:14:44,133: twisted@ERROR: Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 307, in errback
    self._startRunCallbacks(fail)
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 354, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 371, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 879, in gotResult
    _inlineCallbacks(r, g, deferred)
--- <exception caught here> ---
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 821, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.6/dist-packages/twisted/python/failure.py", line 338, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/ensemble/ensemble/ensemble/hooks/protocol.py", line 125, in get
    data = yield context.get(unit_name)
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 821, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.6/dist-packages/twisted/python/failure.py", line 338, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/ensemble/ensemble/ensemble/state/hook.py", line 121, in get
    unit_id = yield self._resolve_name(unit_name)
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 823, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/ensemble/ensemble/ensemble/state/hook.py", line 88, in _resolve_name
    unit_id = self._topology.get_service_unit_id_from_name(unit_name)
  File "/usr/lib/ensemble/ensemble/ensemble/state/topology.py", line 203, in get_service_unit_id_from_name
    service_name, unit_sequence_id = unit_name.split("/")
exceptions.ValueError: need more than 1 value to unpack

It looks like an invalid unit name was passed to relation-get.. Ideally relation-get and all of the hook api would be doing some better validation of cli args, before it gets that far into the ensemble stack.

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

This is probably resolved with the relation-get syntax matching the documented spec, as per bcsaller's branch in review for relation-get.

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

closing out, it looks like this has already been fixed.

Changed in ensemble:
status: New → Fix Released
assignee: nobody → Benjamin Saller (bcsaller)
milestone: none → dublin
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.