Apply the steps in this blueprint to an object. This will apply the ``__init__`` and ``include`` methods of each step, with the object as argument:: step = Step(obj) ... step.include(obj) For :class:`StartStopStep` the services created
(self, parent, **kwargs)
| 184 | pass |
| 185 | |
| 186 | def apply(self, parent, **kwargs): |
| 187 | """Apply the steps in this blueprint to an object. |
| 188 | |
| 189 | This will apply the ``__init__`` and ``include`` methods |
| 190 | of each step, with the object as argument:: |
| 191 | |
| 192 | step = Step(obj) |
| 193 | ... |
| 194 | step.include(obj) |
| 195 | |
| 196 | For :class:`StartStopStep` the services created |
| 197 | will also be added to the objects ``steps`` attribute. |
| 198 | """ |
| 199 | self._debug('Preparing bootsteps.') |
| 200 | order = self.order = [] |
| 201 | steps = self.steps = self.claim_steps() |
| 202 | |
| 203 | self._debug('Building graph...') |
| 204 | for S in self._finalize_steps(steps): |
| 205 | step = S(parent, **kwargs) |
| 206 | steps[step.name] = step |
| 207 | order.append(step) |
| 208 | self._debug('New boot order: {%s}', |
| 209 | ', '.join(s.alias for s in self.order)) |
| 210 | for step in order: |
| 211 | step.include(parent) |
| 212 | return self |
| 213 | |
| 214 | def connect_with(self, other): |
| 215 | self.graph.adjacent.update(other.graph.adjacent) |