Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:fix_all_proposed_duplicate_requests 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/447893 -- Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:fix_all_proposed_duplicate_requests into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py index 1e31008..a4734e4 100644 --- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py +++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py @@ -87,11 +87,9 @@ class Submit: Raise ValueError with error messsage if the request is invalid, otherwise return. """ - not_needed, msg = self.is_request_queued_or_running( - release, arch, package, triggers + self.is_request_queued_or_running( + release, arch, package, triggers, kwargs ) - if not_needed: - raise DuplicateRequestException(msg) can_upload_any_trigger = False @@ -238,11 +236,9 @@ class Submit: else: triggers.append(env_var.split("=")[1]) - not_needed, msg = self.is_request_queued_or_running( - release, arch, package, triggers + self.is_request_queued_or_running( + release, arch, package, triggers, kwargs ) - if not_needed: - raise DuplicateRequestException(msg) if release not in self.releases: raise ValueError("Unknown release " + release) @@ -541,7 +537,9 @@ class Submit: logging.debug("lp_request %s succeeded: %s", url, response) return (code, response) - def is_test_running(self, req_series, req_arch, req_package, req_triggers): + def is_test_running( + self, req_series, req_arch, req_package, req_triggers, kwargs + ): if not os.path.isfile(RUNNING_FP): return False data = {} @@ -557,18 +555,27 @@ class Submit: triggers = triggers[ triggers.find("[") + 1 : triggers.find("]") ] + all_proposed_same = False + if ( + "all-proposed_1" in submitted + and "all-proposed" in kwargs.keys() + or "all-proposed_1" not in submitted + and "all-proposed" not in kwargs.keys() + ): + all_proposed_same = True triggers = triggers.replace("'", "").split(", ") if ( req_arch in architectures and req_series in releases and req_package == pkg and sorted(triggers) == sorted(req_triggers) + and all_proposed_same ): return True return False def is_test_in_queue( - self, req_series, req_arch, req_package, req_triggers + self, req_series, req_arch, req_package, req_triggers, kwargs ): if not os.path.isfile(QUEUE_FP): return False @@ -601,14 +608,28 @@ class Submit: "triggers": sorted(triggers), } if test == this_test: - return True + if ( + "all-proposed" + in data[test_type][release][arch][ + "requests" + ] + and "all-proposed" in kwargs.keys() + or "all-proposed" + not in data[test_type][release][arch][ + "requests" + ] + and "all-proposed" not in kwargs.keys() + ): + return True + else: + return False return False def is_request_queued_or_running( - self, req_series, req_arch, req_package, req_triggers=[] + self, req_series, req_arch, req_package, req_triggers=[], kwargs={} ): if self.is_test_running( - req_series, req_arch, req_package, req_triggers + req_series, req_arch, req_package, req_triggers, kwargs ): o_msg = "Requested test is already running." o_msg += "\nRelease: " + req_series @@ -618,7 +639,7 @@ class Submit: return True, o_msg if self.is_test_in_queue( - req_series, req_arch, req_package, req_triggers + req_series, req_arch, req_package, req_triggers, kwargs ): o_msg = "Requested test is already queued." o_msg += "\nRelease: " + req_series
-- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp