Storing the state of script between steps
usanovdd at gmail.com
Fri Feb 21 21:59:11 CET 2014
First of all I would like to apologize for the name of topic. I really didn't know how to name it more correctly.
I mostly develop on Python some automation scripts such as deployment (it's not about fabric and may be not ssh at all), testing something, etc. In this terms I have such abstraction as "step".
And the certain steps:
class DeployStep: ...
class ValidateUSBFlash: ...
class SwitchVersionS: ...
Where I implement run method.
Then I use some "builder" class which can add steps to internal list and has a method "start" running all step one by one.
And I like this. It's loosely coupled system. It works fine in simple cases. But sometimes some steps have to use the results from previous steps. And now I have problems. Before now I had internal dict in "builder" and named it as "world" and passed it to each run() methods of steps. It worked but I disliked this.
How would you solve this problem and how would you do it? I understant that it's more architecture specific question, not a python one.
I bet I wouldn't have asked this if I had worked with some of functional programming languages.
More information about the Python-list