From 09dcbd74f6036c5cf38bd775e2cfe7c2adeb98eb Mon Sep 17 00:00:00 2001
From: Nicolas Wavrant <nicolas.wavrant@nexedi.com>
Date: Tue, 2 May 2017 06:42:51 +0000
Subject: [PATCH] erp5_upgrader: do not run activeSense for post-upgrade step

As results may be inconsistent as long as pre-upgrade and upgrade steps have been run for real
---
 .../erp5_upgrader/Alarm_runFullUpgrader.py        | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Alarm_runFullUpgrader.py b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Alarm_runFullUpgrader.py
index 4da1ee22dd..6d0f1af075 100644
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Alarm_runFullUpgrader.py
+++ b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Alarm_runFullUpgrader.py
@@ -12,6 +12,9 @@ pre_upgrade_tag = '%s-preupgrade' % tag
 upgrade_tag = '%s-upgrade' % tag
 post_upgrade_tag = '%s-postupgrade' % tag
 
+active_process = context.newActiveProcess()
+
+
 portal_alarms.upgrader_check_pre_upgrade.activate(
   activity='SQLQueue',
   tag=pre_upgrade_tag,
@@ -23,15 +26,15 @@ portal_alarms.upgrader_check_upgrader.activate(
   after_tag=pre_upgrade_tag,
  ).activeSense(fixit=fixit, params={'tag': upgrade_tag})
 
-portal_alarms.upgrader_check_post_upgrade.activate(
-  activity='SQLQueue',
-  tag=post_upgrade_tag,
-  after_tag=upgrade_tag,
-).activeSense(fixit=fixit, params={'tag': post_upgrade_tag})
+if fixit:
+  portal_alarms.upgrader_check_post_upgrade.activate(
+    activity='SQLQueue',
+    tag=post_upgrade_tag,
+    after_tag=upgrade_tag,
+  ).activeSense(fixit=fixit, params={'tag': post_upgrade_tag})
 
 
 # start another activity to collect the results from each upgrader step
-active_process = context.newActiveProcess()
 context.activate(after_tag=post_upgrade_tag).Alarm_postFullUpgradeNeed(
   active_process=active_process.getRelativeUrl())
 
-- 
2.30.9