mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-07-03 20:41:29 +00:00
Skip unimplemented policies in excuses
Return PolicyVerdict.NOT_APPLICABLE, which means no data is added to policy_info in the excuse. Signed-off-by: Ivo De Decker <ivodd@debian.org>
This commit is contained in:
parent
b395c6f760
commit
49d9a38d25
@ -4,6 +4,10 @@ from enum import Enum, unique
|
|||||||
class PolicyVerdict(Enum):
|
class PolicyVerdict(Enum):
|
||||||
""""""
|
""""""
|
||||||
"""
|
"""
|
||||||
|
The policy doesn't apply to this item. No test was done.
|
||||||
|
"""
|
||||||
|
NOT_APPLICABLE = 0
|
||||||
|
"""
|
||||||
The migration item passed the policy.
|
The migration item passed the policy.
|
||||||
"""
|
"""
|
||||||
PASS = 1
|
PASS = 1
|
||||||
|
@ -112,10 +112,11 @@ class BasePolicy(object):
|
|||||||
|
|
||||||
def apply_src_policy(self, general_policy_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
|
def apply_src_policy(self, general_policy_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
|
||||||
pinfo = {}
|
pinfo = {}
|
||||||
general_policy_info[self.policy_id] = pinfo
|
|
||||||
verdict = self.apply_src_policy_impl(pinfo, suite, source_name, source_data_tdist, source_data_srcdist, excuse)
|
verdict = self.apply_src_policy_impl(pinfo, suite, source_name, source_data_tdist, source_data_srcdist, excuse)
|
||||||
# The base policy provides this field, so the subclass should leave it blank
|
# The base policy provides this field, so the subclass should leave it blank
|
||||||
assert 'verdict' not in pinfo
|
assert 'verdict' not in pinfo
|
||||||
|
if verdict != PolicyVerdict.NOT_APPLICABLE:
|
||||||
|
general_policy_info[self.policy_id] = pinfo
|
||||||
pinfo['verdict'] = verdict.name
|
pinfo['verdict'] = verdict.name
|
||||||
return verdict
|
return verdict
|
||||||
|
|
||||||
@ -145,14 +146,15 @@ class BasePolicy(object):
|
|||||||
|
|
||||||
:return A Policy Verdict (e.g. PolicyVerdict.PASS)
|
:return A Policy Verdict (e.g. PolicyVerdict.PASS)
|
||||||
"""
|
"""
|
||||||
return PolicyVerdict.PASS
|
return PolicyVerdict.NOT_APPLICABLE
|
||||||
|
|
||||||
def apply_srcarch_policy(self, general_policy_info, suite, source_name, arch, source_data_tdist, source_data_srcdist, excuse):
|
def apply_srcarch_policy(self, general_policy_info, suite, source_name, arch, source_data_tdist, source_data_srcdist, excuse):
|
||||||
pinfo = {}
|
pinfo = {}
|
||||||
general_policy_info[self.policy_id] = pinfo
|
|
||||||
verdict = self.apply_srcarch_policy_impl(pinfo, suite, source_name, arch, source_data_tdist, source_data_srcdist, excuse)
|
verdict = self.apply_srcarch_policy_impl(pinfo, suite, source_name, arch, source_data_tdist, source_data_srcdist, excuse)
|
||||||
# The base policy provides this field, so the subclass should leave it blank
|
# The base policy provides this field, so the subclass should leave it blank
|
||||||
assert 'verdict' not in pinfo
|
assert 'verdict' not in pinfo
|
||||||
|
if verdict != PolicyVerdict.NOT_APPLICABLE:
|
||||||
|
general_policy_info[self.policy_id] = pinfo
|
||||||
pinfo['verdict'] = verdict.name
|
pinfo['verdict'] = verdict.name
|
||||||
return verdict
|
return verdict
|
||||||
|
|
||||||
@ -183,7 +185,7 @@ class BasePolicy(object):
|
|||||||
:return A Policy Verdict (e.g. PolicyVerdict.PASS)
|
:return A Policy Verdict (e.g. PolicyVerdict.PASS)
|
||||||
"""
|
"""
|
||||||
# if the policy doesn't implement this function, assume it's OK
|
# if the policy doesn't implement this function, assume it's OK
|
||||||
return PolicyVerdict.PASS
|
return PolicyVerdict.NOT_APPLICABLE
|
||||||
|
|
||||||
|
|
||||||
class SimplePolicyHint(Hint):
|
class SimplePolicyHint(Hint):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user