From 2fc265be911690e933a45e3e9fb5d0469496f0d7 Mon Sep 17 00:00:00 2001
From: Paul Gevers <elbrus@debian.org>
Date: Sat, 24 Aug 2019 21:46:59 +0200
Subject: [PATCH] Save the state of policies on every non-dry run, not only
 during migration runs

The autopkgtest policy is really sending requests during every non-dry run,
we want to capture that state.
---
 britney.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/britney.py b/britney.py
index 833e36d..09286f3 100755
--- a/britney.py
+++ b/britney.py
@@ -1216,8 +1216,6 @@ class Britney(object):
         if not self.options.dry_run:
             target_suite = self.suite_info.target_suite
 
-            self._policy_engine.save_state(self)
-
             # write HeidiResult
             self.logger.info("Writing Heidi results to %s", self.options.heidi_output)
             write_heidi(self.options.heidi_output,
@@ -1484,6 +1482,8 @@ class Britney(object):
                 self.logger.info('>   %s', stat)
         else:
             self.logger.info('Migration computation skipped as requested.')
+        if not self.options.dry_run:
+            self._policy_engine.save_state(self)
         logging.shutdown()