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

modules/portage: fix usage with withbdeps: false (#6456)

Using ``withbdeps: false`` was causing the underlying emerge command to
fail due to not passing an argument to the ``--with-bdeps`` flag.  Fix
by updating the logic for generating the emerge command arguments to
ensure that ``withbdeps: false`` results in a passing an ``n`` argument
with the ``--with-bdeps`` emerge flag.
This commit is contained in:
Daniel Harding 2023-05-03 23:44:28 +03:00 committed by GitHub
parent 27a3d6d85d
commit fab717bb2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "portage - update the logic for generating the emerge command arguments to ensure that ``withbdeps: false`` results in a passing an ``n`` argument with the ``--with-bdeps`` emerge flag (https://github.com/ansible-collections/community.general/issues/6451, https://github.com/ansible-collections/community.general/pull/6456)."

View file

@ -383,14 +383,12 @@ def emerge_packages(module, packages):
"""Fallback to default: don't use this argument at all.""" """Fallback to default: don't use this argument at all."""
continue continue
if not flag_val: """Add the --flag=value pair."""
if isinstance(flag_val, bool):
args.extend((arg, to_native('y' if flag_val else 'n')))
elif not flag_val:
"""If the value is 0 or 0.0: add the flag, but not the value.""" """If the value is 0 or 0.0: add the flag, but not the value."""
args.append(arg) args.append(arg)
continue
"""Add the --flag=value pair."""
if isinstance(p[flag], bool):
args.extend((arg, to_native('y' if flag_val else 'n')))
else: else:
args.extend((arg, to_native(flag_val))) args.extend((arg, to_native(flag_val)))