Bootstep that must be started and stopped in order.
| 353 | |
| 354 | |
| 355 | class StartStopStep(Step): |
| 356 | """Bootstep that must be started and stopped in order.""" |
| 357 | |
| 358 | #: Optional obj created by the :meth:`create` method. |
| 359 | #: This is used by :class:`StartStopStep` to keep the |
| 360 | #: original service object. |
| 361 | obj = None |
| 362 | |
| 363 | def start(self, parent): |
| 364 | if self.obj: |
| 365 | return self.obj.start() |
| 366 | |
| 367 | def stop(self, parent): |
| 368 | if self.obj: |
| 369 | return self.obj.stop() |
| 370 | |
| 371 | def close(self, parent): |
| 372 | pass |
| 373 | |
| 374 | def terminate(self, parent): |
| 375 | if self.obj: |
| 376 | return getattr(self.obj, 'terminate', self.obj.stop)() |
| 377 | |
| 378 | def include(self, parent): |
| 379 | inc, ret = self._should_include(parent) |
| 380 | if inc: |
| 381 | self.obj = ret |
| 382 | parent.steps.append(self) |
| 383 | return inc |
| 384 | |
| 385 | |
| 386 | class ConsumerStep(StartStopStep): |
no outgoing calls