drop ahriman.core.triggers.Trigger.run method

In order to force new triggers to use on_result method, the old method
has been removed. However, default on_result method still checks if the
old method exists and tries to run it
This commit is contained in:
2022-10-19 20:07:31 +03:00
parent c1d74726b7
commit 1e8388af5d
2 changed files with 14 additions and 24 deletions

View File

@ -70,7 +70,8 @@ class Trigger(LazyLogging):
result(Result): build result
packages(Iterable[Package]): list of all available packages
"""
self.run(result, packages) # compatibility with old triggers
if (run := getattr(self, "run", None)) is not None:
run(result, packages) # compatibility with old triggers
def on_start(self) -> None:
"""
@ -81,16 +82,3 @@ class Trigger(LazyLogging):
"""
trigger action which will be called before the stop of the application
"""
def run(self, result: Result, packages: Iterable[Package]) -> None:
"""
run trigger
Note:
This method is deprecated and will be removed in the future versions. In order to run old-style trigger
action the ``on_result`` method must be used.
Args:
result(Result): build result
packages(Iterable[Package]): list of all available packages
"""