Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#2930 closed defect (fixed)

New-style class in 0.8.9 always results in exception in logfile

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

Description (last modified by dustin)

class MyStep(BuildStep, ShellMixin):
   def __init__(self, script, **kwargs):
       self._script = script
       kwargs = self.setupShellMixin(kwargs,prohibitArgs=['command'])
       BuildStep.__init__(self, **kwargs)

   @defer.inlineCallbacks
   def run(self):
       cmd = yield self.makeRemoteShellCommand(command=[self._script],
                                               collectStdout=True,
                                               collectStderr=True)
       yield self.runCommand(cmd)
       if cmd.didFail():
           defer.returnValue(cmd.results())
       // do something with cmd.stdout

When I add MyStep? to my factory, the stdio log file contains the exception below

web.Server Traceback (most recent call last):
exceptions.AssertionError: not available in new-style steps
 <python framework>/Extras/lib/python/twisted/web/server.py:189 in process
   188                              self._encoder = encoder
   189                      self.render(resrc)
   190                  except:

 <python framework>/Extras/lib/python/twisted/web/server.py:238 in render
   237                  try:
   238                      body = resrc.render(self)
   239                  except UnsupportedMethod as e:

 <python framework>/Extras/lib/python/twisted/web/resource.py:250 in render
   249                      raise UnsupportedMethod(allowedMethods)
   250                  return m(request)
   251

 <packages>/site-packages/buildbot/status/web/logs.py:140 in render_GET
    139
    140         self.original.subscribeConsumer(ChunkConsumer(req, self))
    141         return server.NOT_DONE_YET

  <packages>/buildbot/status/logfile.py:436 in subscribeConsumer
    435 def subscribeConsumer(self, consumer):
    436 assert not self._isNewStyle, "not available in new-style steps"
    437 p = LogFileProducer(self, consumer)
 exceptions.AssertionError: not available in new-style steps

Change History (5)

comment:1 Changed 4 years ago by vlovich

Apologies. I should've previewed. Fixed formatting:

class MyStep(BuildStep, ShellMixin):
   def __init__(self, script, **kwargs):
       self._script = script
       kwargs = self.setupShellMixin(kwargs,prohibitArgs=['command'])
       BuildStep.__init__(self, **kwargs)

   @defer.inlineCallbacks
   def run(self):
       cmd = yield self.makeRemoteShellCommand(command=[self._script],
                                               collectStdout=True,
                                               collectStderr=True)
       yield self.runCommand(cmd)
       if cmd.didFail():
           defer.returnValue(cmd.results())
       // do something with cmd.stdout
web.Server Traceback (most recent call last):
exceptions.AssertionError: not available in new-style steps
 <python framework>/Extras/lib/python/twisted/web/server.py:189 in process
   188                              self._encoder = encoder
   189                      self.render(resrc)
   190                  except:

 <python framework>/Extras/lib/python/twisted/web/server.py:238 in render
   237                  try:
   238                      body = resrc.render(self)
   239                  except UnsupportedMethod as e:

 <python framework>/Extras/lib/python/twisted/web/resource.py:250 in render
   249                      raise UnsupportedMethod(allowedMethods)
   250                  return m(request)
   251

 <packages>/site-packages/buildbot/status/web/logs.py:140 in render_GET
    139
    140         self.original.subscribeConsumer(ChunkConsumer(req, self))
    141         return server.NOT_DONE_YET

  <packages>/buildbot/status/logfile.py:436 in subscribeConsumer
    435 def subscribeConsumer(self, consumer):
    436 assert not self._isNewStyle, "not available in new-style steps"
    437 p = LogFileProducer(self, consumer)
 exceptions.AssertionError: not available in new-style steps

comment:2 Changed 4 years ago by dustin

  • Description modified (diff)
  • Milestone changed from undecided to 0.8.x
  • Owner set to dustin
  • Status changed from new to assigned

comment:3 Changed 4 years ago by vlovich

comment:4 Changed 4 years ago by dustin

  • Resolution set to fixed
  • Status changed from assigned to closed

This is fixed, but not yet released. Let's see what happens -- if everyone ends up manually applying this patch, then we should think about another release.

comment:5 Changed 4 years ago by dustin

(I'm adding a test that triggers this issue in the fix for #2934)

Note: See TracTickets for help on using tickets.