summaryrefslogtreecommitdiff
path: root/lorrycontroller
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-10-02 11:18:13 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-10-02 11:18:13 +0100
commit1b82571cf0373ca6928fc1757c626fe9dbc6c77b (patch)
tree2be017eddcc9a87123bbfde94fbe56dafe906a24 /lorrycontroller
parent8a4fdf418e9f5c156e1f72bfab56d5f1a41a3c8d (diff)
downloadlorry-controller-1b82571cf0373ca6928fc1757c626fe9dbc6c77b.tar.gz
Add a dry-run support
Diffstat (limited to 'lorrycontroller')
-rw-r--r--lorrycontroller/workingstate.py7
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,