diff --git a/osc-staging.py b/osc-staging.py index 308337ed..4cf79910 100644 --- a/osc-staging.py +++ b/osc-staging.py @@ -339,6 +339,12 @@ def do_staging(self, subcmd, opts, *args): return splitter = RequestSplitter(api, open_requests, in_ring=True) + + considerable = splitter.stagings_load(stagings) + if considerable == 0: + print('No considerable stagings on which to act') + return + if len(requests) > 0: splitter.filter_add_requests(requests) if len(splitter.filters) == 0: @@ -352,7 +358,7 @@ def do_staging(self, subcmd, opts, *args): splitter.group_by(group_by) splitter.split() - result = splitter.propose_assignment(stagings) + result = splitter.propose_assignment() if result is not True: print('Failed to generate proposal: {}'.format(result)) return diff --git a/osclib/request_splitter.py b/osclib/request_splitter.py index 289c464f..314ce76c 100644 --- a/osclib/request_splitter.py +++ b/osclib/request_splitter.py @@ -125,7 +125,7 @@ class RequestSplitter(object): return '00' return '__'.join(key) - def propose_stagings_load(self, stagings): + def stagings_load(self, stagings): self.stagings_considerable = {} if self.api.rings: @@ -156,10 +156,9 @@ class RequestSplitter(object): # Allow both considered and remaining to be accessible after proposal. self.stagings_available = self.stagings_considerable.copy() - def propose_assignment(self, stagings): - # Determine available stagings and make working copy. - self.propose_stagings_load(stagings) + return len(self.stagings_considerable) + def propose_assignment(self): if len(self.grouped) > len(self.stagings_available): return 'more groups than available stagings'