generated from linux-system-roles/template
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: This PR is to trigger periodic CI testing
- Loading branch information
1 parent
2679ce9
commit a4bd034
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |