diff --git a/changelogs/fragments/6149-openbsd_pkg-term.yml b/changelogs/fragments/6149-openbsd_pkg-term.yml new file mode 100644 index 0000000000..5fe1e5a6db --- /dev/null +++ b/changelogs/fragments/6149-openbsd_pkg-term.yml @@ -0,0 +1,2 @@ +minor_changes: + - openbsd_pkg - set ``TERM`` to ``'dumb'`` in ``execute_command()`` to make module less dependant on the ``TERM`` environment variable set on the Ansible controller (https://github.com/ansible-collections/community.general/pull/6149). diff --git a/plugins/modules/openbsd_pkg.py b/plugins/modules/openbsd_pkg.py index 62a662c3c4..2baea828ab 100644 --- a/plugins/modules/openbsd_pkg.py +++ b/plugins/modules/openbsd_pkg.py @@ -152,7 +152,11 @@ def execute_command(cmd, module): # This makes run_command() use shell=False which we need to not cause shell # expansion of special characters like '*'. cmd_args = shlex.split(cmd) - return module.run_command(cmd_args) + + # We set TERM to 'dumb' to keep pkg_add happy if the machine running + # ansible is using a TERM that the managed machine does not know about, + # e.g.: "No progress meter: failed termcap lookup on xterm-kitty". + return module.run_command(cmd_args, environ_update={'TERM': 'dumb'}) # Function used to find out if a package is currently installed.