Opened 5 years ago

Last modified 5 years ago

#2891 new defect

Exception when using Interpolate in description

Reported by: sa2ajj Owned by:
Priority: major Milestone: 0.8.x
Version: 0.8.9 Keywords:
Cc:

Description

Per discussion at IRC:

This step:

        build_factory.addStep(ShellCommand(
                command=['cmd', 'param', ..., 'param'],
        haltOnFailure=True,
        #description=Interpolate("configure %(prop:Environment)s"),
        description="configure the new environment",
        doStepIf=lambda step: step.build.getProperty("state") == "present"
        ))

causes an exception

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1155, in gotResult
    _inlineCallbacks(r, g, deferred)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1142, in _inlineCallbacks
    deferred.callback(e.value)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 382, in callback
    self._startRunCallbacks(result)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 490, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 577, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/buildbot/process/buildstep.py", line 653, in _gotResults
    self.setStatus(cmd, results)
  File "/usr/local/lib/python2.7/dist-packages/buildbot/process/buildstep.py", line 739, in setStatus
    self._step_status.setText(self.getText(cmd, results))
  File "/usr/local/lib/python2.7/dist-packages/buildbot/process/buildstep.py", line 716, in getText
    return self.describe(True) + ["failed"]
exceptions.TypeError: coercing to Unicode: need string or buffer, list found

Change History (6)

comment:1 Changed 5 years ago by sa2ajj

After a bit of code reading and thinking, it looks like this little snippet gives the same outcome:

a = u'Hello'
b = a + ['world']
Last edited 5 years ago by sa2ajj (previous) (diff)

comment:2 Changed 5 years ago by sa2ajj

So documentation gives examples when all the fields are lists of "small strings".

Probably some sanity check for the parameters need to be implemented.

comment:4 Changed 5 years ago by sa2ajj

(Sorry, the code link above was incorrect for master.)

comment:5 Changed 5 years ago by dustin

That pull req was invalid: description, descriptionDone, and descriptionSuffix can be lists or strings.

So I think the bug is that ShellCommand.describe is not returning a list. This is all getting rewritten as part of #2818, so the remaining fix here is eight-only. And the workaround is just to add .. to the description parameter.

comment:6 Changed 5 years ago by dustin

  • Milestone changed from 0.9.+ to 0.8.x
Note: See TracTickets for help on using tickets.