← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:admin-page-no-fail-when-empty into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:admin-page-no-fail-when-empty into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/465851
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:admin-page-no-fail-when-empty into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/helpers/admin.py b/charms/focal/autopkgtest-web/webcontrol/helpers/admin.py
index afc406b..39c837a 100644
--- a/charms/focal/autopkgtest-web/webcontrol/helpers/admin.py
+++ b/charms/focal/autopkgtest-web/webcontrol/helpers/admin.py
@@ -17,16 +17,17 @@ def select_abnormally_long_jobs(running_info, get_test_id, db_con):
                         (test_id,),
                     )
                     duration_avg = row.fetchone()[0]
-                    if (
-                        (duration)
-                        > duration_avg
-                        * MAX_DURATION_FACTOR_BEFORE_CONSIDERED_WEIRD
-                    ):
-                        pruned_running_info.setdefault(
-                            running_pkg, {}
-                        ).setdefault(skey, {}).setdefault(
-                            release, {}
-                        ).setdefault(
-                            arch, vals
-                        )
+                    if duration_avg is not None:
+                        if (
+                            (duration)
+                            > duration_avg
+                            * MAX_DURATION_FACTOR_BEFORE_CONSIDERED_WEIRD
+                        ):
+                            pruned_running_info.setdefault(
+                                running_pkg, {}
+                            ).setdefault(skey, {}).setdefault(
+                                release, {}
+                            ).setdefault(
+                                arch, vals
+                            )
     return pruned_running_info