Reduce code duplication in last commit.
This commit is contained in:
parent
da296f2f91
commit
479b80ce61
17
osc-group.py
17
osc-group.py
@ -174,6 +174,9 @@ def _group_verify_grouping(self, srids, opts, require_grouping = False):
|
||||
# package is not in group so we append it for return
|
||||
grids.append(sr)
|
||||
|
||||
if not require_grouping and len(grids) < 1:
|
||||
raise oscerr.WrongArgs('All added submit request already are in groups: {0}'.format(', '.join(srids)))
|
||||
|
||||
return grids
|
||||
|
||||
def _group_verify_type(self, grid, opts):
|
||||
@ -212,12 +215,7 @@ def _group_create(self, name, pkgs, opts):
|
||||
"""
|
||||
|
||||
srids = self._group_find_sr(pkgs, opts)
|
||||
srids_filtered = self._group_verify_grouping(srids, opts)
|
||||
|
||||
if len(srids_filtered) > 0:
|
||||
srids = srids_filtered
|
||||
else:
|
||||
raise oscerr.WrongArgs('All added submit request already are in some group: {0}'.format(', '.join(srids)))
|
||||
srids = self._group_verify_grouping(srids, opts)
|
||||
|
||||
# compose the xml
|
||||
xml='<request><action type="group">'
|
||||
@ -246,12 +244,7 @@ def _group_add(self, grid, pkgs, opts):
|
||||
returned_group = self._group_verify_type(grid, opts)
|
||||
if returned_group:
|
||||
srids = self._group_find_sr(pkgs, opts)
|
||||
srids_filtered = self._group_verify_grouping(srids, opts)
|
||||
|
||||
if len(srids_filtered) > 0:
|
||||
srids = srids_filtered
|
||||
else:
|
||||
raise oscerr.WrongArgs('All added submit request already are in groups: {0}'.format(', '.join(srids)))
|
||||
srids = self._group_verify_grouping(srids, opts)
|
||||
else:
|
||||
# here we add the grid to pkgs and search among all to get at least one
|
||||
# usefull group request id
|
||||
|
Loading…
x
Reference in New Issue
Block a user