From ec47f43f79486e670a0679463ea86009bc4d37c0 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Wed, 13 Oct 2021 00:50:01 +0000 Subject: [PATCH] pkgng: oops, pkgsite should be from closure I put `pkgsite` as a keyword argument to `run_pkgng()', which wasn't correct at all and resulted it in capturing the second positional argument given by any caller. `pkgsite` should have been `p["pkgsite"]`, coming from the closure environment of `main()`. --- plugins/modules/packaging/os/pkgng.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/packaging/os/pkgng.py b/plugins/modules/packaging/os/pkgng.py index 1a591da5fd..ff7e45fa96 100644 --- a/plugins/modules/packaging/os/pkgng.py +++ b/plugins/modules/packaging/os/pkgng.py @@ -468,7 +468,7 @@ def main(): # in /usr/local/etc/pkg/repos repo_flag_not_supported = pkgng_older_than(module, pkgng_path, [1, 1, 4]) - def run_pkgng(action, pkgsite=None, *args, **kwargs): + def run_pkgng(action, *args, **kwargs): cmd = [pkgng_path, dir_arg, action] pkgng_env = {'BATCH': 'yes'} @@ -476,11 +476,11 @@ def main(): if p["ignore_osver"]: pkgng_env['IGNORE_OSVERSION'] = 'yes' - if pkgsite is not None and action in ('update', 'install', 'upgrade',): + if p['pkgsite'] is not None and action in ('update', 'install', 'upgrade',): if repo_flag_not_supported: - pkgng_env['PACKAGESITE'] = pkgsite + pkgng_env['PACKAGESITE'] = p['pkgsite'] else: - cmd.append('--repository=%s' % (pkgsite,)) + cmd.append('--repository=%s' % (p['pkgsite'],)) # If environ_update is specified to be "passed through" # to module.run_command, then merge its values into pkgng_env