1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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()`.
This commit is contained in:
Ross Williams 2021-10-13 00:50:01 +00:00
parent c34df85eac
commit ec47f43f79

View file

@ -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