From a017492a77b13b493bcf02a8a9bad15976a65719 Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: Jun 14 2018 12:06:59 +0000 Subject: Make blacklist policy attribute optional --- diff --git a/docs/policies.rst b/docs/policies.rst index dd031c0..db74367 100644 --- a/docs/policies.rst +++ b/docs/policies.rst @@ -95,7 +95,7 @@ The document is a map (dictionary) with the following keys: Currently there are a few rule types, ``PassingTestCaseRule`` being one of them. See the :ref:`rule-types` section below for a full list. -``blacklist`` +``blacklist`` (optional) A list of binary RPM package names which are exempted from this policy. The blacklist only takes effect when Greenwave is making a decision about diff --git a/greenwave/policies.py b/greenwave/policies.py index 014dfed..6ea018e 100644 --- a/greenwave/policies.py +++ b/greenwave/policies.py @@ -421,6 +421,7 @@ class PackageSpecificBuild(PackageSpecificRule): class Policy(yaml.YAMLObject): yaml_tag = '!Policy' yaml_loader = yaml.SafeLoader + blacklist = [] def applies_to(self, decision_context, product_version, subject_type): return (decision_context == self.decision_context and diff --git a/greenwave/tests/test_policies.py b/greenwave/tests/test_policies.py index b299896..f1fa3a1 100644 --- a/greenwave/tests/test_policies.py +++ b/greenwave/tests/test_policies.py @@ -43,7 +43,6 @@ product_versions: - fedora-rawhide decision_context: rawhide_compose_sync_to_mirrors subject_type: compose -blacklist: [] rules: - !PassingTestCaseRule {test_case_name: sometest} """) @@ -72,7 +71,6 @@ product_versions: - rhel-9000 decision_context: bodhi_update_push_stable subject_type: koji_build -blacklist: [] rules: - !PackageSpecificBuild {test_case_name: sometest, repos: [nethack, python-*]} """) @@ -227,7 +225,6 @@ product_versions: - fedora-* decision_context: dummy_context subject_type: bodhi_update -blacklist: [] rules: [] """) policies = load_policies(tmpdir.strpath) @@ -251,7 +248,6 @@ product_versions: - fedora-26 decision_context: bodhi_update_push_stable_with_remoterule subject_type: koji_build -blacklist: [] rules: - !RemoteRule {} """ @@ -262,7 +258,6 @@ id: "some-policy-from-a-random-packager" product_versions: - fedora-26 decision_context: bodhi_update_push_stable_with_remoterule -blacklist: [] rules: - !PassingTestCaseRule {test_case_name: dist.upgradepath} """