ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
787 stars 1.45k forks source link

pacman: Apply extra arguments to all pacman commands #438

Open maxbrunet opened 4 years ago

maxbrunet commented 4 years ago
SUMMARY

Support injecting extra arguments to all pacman commands (update, query, install...).

For example query_package() does not support extra arguments: https://github.com/ansible-collections/community.general/blob/f81e562301e1d69be98b51138d4c859f7c92daa0/plugins/modules/packaging/os/pacman.py#L172

I'm thinking about re-purposing the extra_args parameter and use it everywhere, or adding a global_extra_args parameter.

ISSUE TYPE
COMPONENT NAME

pacman

ADDITIONAL INFORMATION

I want to be able to change the root directory by using the --root and --cachedir arguments, similarly to how pacstrap does.

- name: Install packages in new root
  pacman:
    name:
    - base
    - base-devel
    - python
    extra_args: &extra_args >-
      --root=/mnt
      --cachedir=/mnt/var/cache/pacman/pkg
      --config=/path/to/another/config
    update_cache: true
    update_cache_extra_args: *extra_args

Currently, this will skip the packages installed outside the root, since query_package() does not use any extra arguments.

ansibullbot commented 4 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 4 years ago

cc @bcoca @danowar2k @fishman @indrajitr @jasperla @jpdasma @mator @mavit @scathatheworm @tchernomax @troy2914 @xen0l click here for bot help

felixfontein commented 4 years ago

I don't think such generic extra argument options are a good idea. They can break all kind of things, or make it impossible to implement certain new features later.

How about adding direct support for the options you need?

maxbrunet commented 4 years ago

Sure! I agree. --root, --cachedir, and --config would be a good start. I might work on that if I have time

aminvakil commented 3 years ago

@maxbrunet Are you still willing to work on this?

maxbrunet commented 3 years ago

Hi @aminvakil, no, I haven't even started, please feel free to take a stab at it if you have time.

ansibullbot commented 1 year ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @jraby click here for bot help