Skip to content

Commit

Permalink
Fix ShellSequence status strings; do error reporting in twistd.log
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Sep 25, 2014
1 parent b2d42a0 commit e54c6fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion master/buildbot/steps/shellsequence.py
Expand Up @@ -18,6 +18,7 @@
from buildbot.process import buildstep
from buildbot.status import results
from twisted.internet import defer
from twisted.python import log


class ShellArg(results.ResultComputingConfigMixin):
Expand Down Expand Up @@ -80,14 +81,19 @@ def getFinalState(self):
def runShellSequence(self, commands):
terminate = False
if commands is None:
log.msg("After rendering, ShellSequence `commands` is None")
defer.returnValue(results.EXCEPTION)
overall_result = results.SUCCESS
for arg in commands:
if not isinstance(arg, ShellArg):
log.msg("After rendering, ShellSequence `commands` list "
"contains something that is not a ShellArg")
defer.returnValue(results.EXCEPTION)
try:
arg.validateAttributes()
except config.ConfigErrors:
except config.ConfigErrors, e:
log.msg("After rendering, ShellSequence `commands` is "
"invalid: %s" % (e,))
defer.returnValue(results.EXCEPTION)

# handle the command from the arg
Expand Down
6 changes: 3 additions & 3 deletions master/buildbot/test/unit/test_steps_shellsequence.py
Expand Up @@ -64,19 +64,19 @@ def createDynamicRun(self, commands):
def testSanityChecksAreDoneInRuntimeWhenDynamicCmdIsNone(self):
self.setupStep(self.createDynamicRun(None))
self.expectOutcome(result=EXCEPTION,
state_string="commands == None")
state_string="finished (exception)")
return self.runStep()

def testSanityChecksAreDoneInRuntimeWhenDynamicCmdIsString(self):
self.setupStep(self.createDynamicRun(["one command"]))
self.expectOutcome(result=EXCEPTION,
state_string='one command not ShellArg')
state_string='finished (exception)')
return self.runStep()

def testSanityChecksAreDoneInRuntimeWhenDynamicCmdIsInvalidShellArg(self):
self.setupStep(self.createDynamicRun([shellsequence.ShellArg(command=1)]))
self.expectOutcome(result=EXCEPTION,
state_string='1 invalid params')
state_string='finished (exception)')
return self.runStep()

def testMultipleCommandsAreRun(self):
Expand Down

0 comments on commit e54c6fd

Please sign in to comment.