From 2df09e9d3f2c0e015bd072efde2a63111da87e66 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 07:07:28 +0000 Subject: [PATCH] ci: This PR is to trigger periodic CI testing --- tests/callback_plugins/dump_packages.py | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/callback_plugins/dump_packages.py diff --git a/tests/callback_plugins/dump_packages.py b/tests/callback_plugins/dump_packages.py new file mode 100644 index 0000000..3ec9cf1 --- /dev/null +++ b/tests/callback_plugins/dump_packages.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2023, Red Hat, Inc. +# SPDX-License-Identifier: MIT + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ + author: Rich Megginson + name: dump_packages + type: aggregate + short_description: dump arguments to package module + description: + - Dump arguments to package module to get list of packages. + - Used in conjunction with CI testing to get the packages used + - with all combinations of: distribution/version/role arguments + - Used to generate lists of packages for ostree image builds. + requirements: + - None +""" + +from ansible.plugins.callback import CallbackBase # noqa: E402 + + +class CallbackModule(CallbackBase): + """ + Dump packages. + """ + + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = "aggregate" + CALLBACK_NAME = "dump_packages" + # needed for 2.9 compatibility + CALLBACK_NEEDS_WHITELIST = False # wokeignore:rule=whitelist + CALLBACK_NEEDS_ENABLED = False + + def __init__(self, *args, **kwargs): + super(CallbackModule, self).__init__(*args, **kwargs) + + def v2_runner_on_ok(self, result): + fields = result._task_fields + if fields["action"] == "package" and fields["args"].get("state") != "absent": + if isinstance(fields["args"]["name"], list): + packages = " ".join(fields["args"]["name"]) + else: + packages = fields["args"]["name"] + self._display.display("lsrpackages: " + packages)