Bug 274408 - sysutils/ansible - When installing a collection from ansible-galaxy, a python module is required
Summary: sysutils/ansible - When installing a collection from ansible-galaxy, a python...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-11 08:02 UTC by Vladyslav V. Prodan
Modified: 2023-10-12 16:10 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (cy)


Attachments
sysutils/ansible: Support ansible-galaxy install from community (1.33 KB, patch)
2023-10-11 14:06 UTC, Cy Schubert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladyslav V. Prodan 2023-10-11 08:02:55 UTC
When installing a collection from ansible-galaxy, a python module is required

# ansible-galaxy collection install community.general
Starting galaxy collection install process
ERROR! importlib_resources is not installed and is required

Please add devel/py-importlib-resources as a dependency when installing Ansible, and perhaps also for the ansible-compat and ansible-core packages?


# pkg info | grep ansible
py39-ansible-8.2.0             Radically simple IT automation
py39-ansible-compat-4.1.2      Ansible compatibility goodies
py39-ansible-core-2.15.2       Radically simple IT automation
py39-ansible-lint-6.17.1       Checks playbooks for sub-optimal practices and behaviour

# uname
FreeBSD 13.2-STABLE 74614fa93
Comment 1 Cy Schubert freebsd_committer freebsd_triage 2023-10-11 14:06:43 UTC
Created attachment 245566 [details]
sysutils/ansible: Support ansible-galaxy install from community

Can you try this patch, please?
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-10-11 14:15:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2211c50a41e91d490ee24cacdd496dccccfbc3ad

commit 2211c50a41e91d490ee24cacdd496dccccfbc3ad
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-11 14:04:26 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-11 14:14:51 +0000

    sysutils/ansible: Support ansible-galaxy install from community

    Fix:

    Starting galaxy collection install process
    ERROR! importlib_resources is not installed and is required

    Please add devel/py-importlib-resources as a dependency when installing
    Ansible, and perhaps also for the ansible-compat and ansible-core packages?

    PR:     274408

 sysutils/ansible/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 3 Vladyslav V. Prodan 2023-10-11 19:05:19 UTC
(In reply to commit-hook from comment #2)

Maybe it's worth creating a separate port?
For example:
py39-ansible-collection-community.general-7.5.0 ...
Comment 4 Cy Schubert freebsd_committer freebsd_triage 2023-10-11 23:22:35 UTC
Hmmm. Could you be missing something?

cwsys$ ansible-galaxy collection install community.general
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
cwsys$ pkg info -I \*ansible\*
py39-ansible-8.4.0_1           Radically simple IT automation
py39-ansible-compat-4.1.2      Ansible compatibility goodies
py39-ansible-core-2.15.5       Radically simple IT automation
py39-ansible-kld-g20200803,1   Ansible module to load kernel modules or update /boot/loader.conf
py39-ansible-lint-6.17.1       Checks playbooks for sub-optimal practices and behaviour
py39-ansible-sysrc-g20200803_1,1 Ansible module to set sysvars in rc.conf
cwsys$
Comment 5 Vladyslav V. Prodan 2023-10-12 00:20:16 UTC
(In reply to Cy Schubert from comment #4)

Show your console output:
ansible-galaxy collection verify community.general


I'll try to roll back the virtual machine this afternoon and repeat the error output from the first message.
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2023-10-12 00:43:15 UTC
lippy$ ansible-galaxy collection verify community.general
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-general-7.4.0.tar.gz to /home/cy/.ansible/tmp/ansible-local-67944mdh786_/tmpd7yklwr4/community-general-7.4.0-auu99ohk
Verifying 'community.general:7.4.0'.
Installed collection found at '/usr/local/lib/python3.9/site-packages/ansible_collections/community/general'
MANIFEST.json hash: e9a8761d9a3dcceabd7ad9588dc7179cb6b984d7b359aaaea7c871b6252d098a
Collection community.general contains modified content in the following files:
    .azure-pipelines/scripts/aggregate-coverage.sh
    .azure-pipelines/scripts/combine-coverage.py
[... a lot of filenames ]    plugins/test/__pycache__/a_module.cpython-39.opt-1.pyc
    plugins/test/__pycache__/a_module.cpython-39.pyc
slippy$ 

slippy$ pkg info -I \*ansible\*
py39-ansible-8.4.0_1           Radically simple IT automation
py39-ansible-compat-4.1.2      Ansible compatibility goodies
py39-ansible-core-2.15.5       Radically simple IT automation
py39-ansible-kld-g20200803,1   Ansible module to load kernel modules or update /boot/loader.conf
py39-ansible-lint-6.17.1       Checks playbooks for sub-optimal practices and behaviour
py39-ansible-sysrc-g20200803_1,1 Ansible module to set sysvars in rc.conf
slippy$ 

2456 files found for community.general.

slippy$ pkg info -l sysutils/ansible | grep -c community/general     
2456
slippy$ 

Remember devel/ansilble (py39-ansible-8.4.0_1) is the community contributions.
Comment 7 Cy Schubert freebsd_committer freebsd_triage 2023-10-12 00:44:10 UTC
Also, the ansible-galaxy collection verify will not work if you have a ~/netrc file.
Comment 8 Cy Schubert freebsd_committer freebsd_triage 2023-10-12 02:06:21 UTC
BTW, I took over maintainership of sysutils/py-ansible-core and sysutils/ansible earlier this week. One thing I am planning is to update package descriptions and WWWs. sysutils/py-ansible-core is ansible itself (https://github.com/ansible/ansible.git), while sysutils/ansible is an aggregation of ansible-collections repositories (https://github.com/ansible-collections). I think the name sysutils/ansible is incorrect and should be named sysutils/ansible-collections. I think this is something that I'll need to rectify at some point but not just now, the week I took over maintainership. If not rename the port/packages, clarify what it is in pkg-descr.I think this will avoid some confusion in the FreeBSD community which package contains ansible-collections.
Comment 9 Vladyslav V. Prodan 2023-10-12 07:48:04 UTC
(In reply to Vladyslav V. Prodan from comment #5)

I confirm the problem:

[10:39]ansible2:root-> /root# ansible-galaxy collection list
ERROR! importlib_resources is not installed and is required

# pkg install sysutils/ansible sysutils/py-ansible-core
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed

# pkg info -I \*ansible\*
py39-ansible-8.2.0             Radically simple IT automation
py39-ansible-compat-4.1.2      Ansible compatibility goodies
py39-ansible-core-2.15.2       Radically simple IT automation
py39-ansible-lint-6.17.1       Checks playbooks for sub-optimal practices and behaviour

# pkg remove sysutils/py-ansible-core

# pkg install sysutils/ansible sysutils/py-ansible-core py39-ansible-compat py39-ansible-lint
...
Proceed with this action? [y/N]: y
[1/4] Installing py39-ansible-core-2.15.2...
[1/4] Extracting py39-ansible-core-2.15.2: 100%
[2/4] Installing py39-ansible-compat-4.1.2...
[2/4] Extracting py39-ansible-compat-4.1.2: 100%
[3/4] Installing py39-ansible-8.2.0...
[3/4] Extracting py39-ansible-8.2.0: 100%
[4/4] Installing py39-ansible-lint-6.17.1...
[4/4] Extracting py39-ansible-lint-6.17.1: 100%

[10:44]ansible2:root-> /root# ansible-galaxy collection list
ERROR! importlib_resources is not installed and is required
Comment 10 Cy Schubert freebsd_committer freebsd_triage 2023-10-12 16:10:00 UTC
Fixed.