diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-10-02 11:18:13 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-10-02 11:18:13 +0100 |
commit | 1b82571cf0373ca6928fc1757c626fe9dbc6c77b (patch) | |
tree | 2be017eddcc9a87123bbfde94fbe56dafe906a24 /lorrycontroller | |
parent | 8a4fdf418e9f5c156e1f72bfab56d5f1a41a3c8d (diff) | |
download | lorry-controller-1b82571cf0373ca6928fc1757c626fe9dbc6c77b.tar.gz |
Add a dry-run support
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/workingstate.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lorrycontroller/workingstate.py b/lorrycontroller/workingstate.py index acaf55b..239ee1f 100644 --- a/lorrycontroller/workingstate.py +++ b/lorrycontroller/workingstate.py @@ -32,7 +32,7 @@ class LorryFileRunner(object): def run_lorry(self, *args): cmdargs = list(args) cmdargs.append(self.lorryfile) - self.mgr.app.runcmd(cmdargs) + self.mgr.app.maybe_runcmd(cmdargs) class WorkingStateManager(object): '''Manage the working state of lorry-controller''' @@ -46,7 +46,10 @@ class WorkingStateManager(object): return self def __exit__(self, exctype, excvalue, exctraceback): - self.save_state() + if not self.app.settings['dry-run']: + self.save_state() + else: + logging.debug("DRY-RUN: Not saving state again") def _load_state(self): self.lorry_state_file = os.path.join(self.workdir, |