awx icon indicating copy to clipboard operation
awx copied to clipboard

Importing an inventory sourced from a manual project fails

Open jean-christophe-manciot opened this issue 5 months ago • 1 comments

Please confirm the following

  • [X] I agree to follow this project's code of conduct.
  • [X] I have checked the current issues for duplicates.
  • [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • [X] I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

As a workaround to the already reported issue Source From A Project Doesn't Show Any Inventory, I used to be able to import inventories sourced from manual projects with the command awx-manage inventory_import run from within the tools_awx_1 container. With AWX 24.6.0, this command now fails.

AWX version

24.6.0

Select the relevant components

  • [ ] UI
  • [ ] UI (tech preview)
  • [ ] API
  • [ ] Docs
  • [ ] Collection
  • [X] CLI
  • [ ] Other

Installation method

docker development environment

Modifications

no

Ansible version

2.17.3

Operating system

Ubuntu 24.04 noble

Web browser

No response

Steps to reproduce

  • Install AWX 24.6.0 using docker-compose
  • Add a projects docker volume for tools_awx container
  • Add all inventories projects
  • Add all playbooks projects
  • Add all roles projects
  • Add all inventories
  • Import all inventories sourced from the manual projects as a workaround to the issue 'Cannot use manual project for SCM-based inventory' - that issue prevents us from using awx.awx.inventory_source module with manual projects as "source"

Expected results

Successful Import of all inventories sourced from the manual projects

Actual results

sh-5.1# awx-manage inventory_import --inventory-name Inventory-1 --source /var/lib/awx/projects/git-Inventory-1/ --overwrite --overwrite-vars
    2.358 INFO     Updating inventory 2: Inventory-1
2024-08-28 14:05:21,641 INFO     [-] awx.analytics.job_lifecycle inventoryupdate-25 created {"type": "inventoryupdate", "task_id": 25, "state": "created", "work_unit_id": null, "task_name": "Inventory-1 -  (Inventory-1 - 25)"}
    2.476 INFO     Reading Ansible inventory source: /var/lib/awx/projects/git-Inventory-1
Traceback (most recent call last):
  File "/usr/local/bin/awx-manage", line 18, in <module>
    load_entry_point('awx', 'console_scripts', 'awx-manage')()
  File "/awx_devel/awx/__init__.py", line 177, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/inventory_import.py", line 896, in handle
    data = AnsibleInventory-1Loader(source=source, verbosity=verbosity).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/inventory_import.py", line 132, in load
    return self.command_to_json(base_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/inventory_import.py", line 116, in command_to_json
    raise RuntimeError('%s failed (rc=%d) with stdout:\n%s\nstderr:\n%s' % ('ansible-inventory', proc.returncode, stdout, stderr))
RuntimeError: ansible-inventory failed (rc=127) with stdout:

stderr:
Error: crun: writing file `/sys/fs/cgroup/libpod_parent/libpod-4ccd4c5a4e1c85d9328a135745860ec898efe81e4a4548a0bbc279935aed7191/cgroup.procs`: No such file or directory: OCI runtime attempted to invoke a command that was not found

sh-5.1# ls -al /var/lib/awx/projects/git-Inventory-1
total 36
drwxr-x---  4 root root  4096 Aug 28 12:53 .
drwxr-x--- 19 root root  4096 Feb 27  2024 ..
drwxr-x--- 66 root root  4096 Aug 27 15:29 group_vars
-rw-r-----  1 root root 20321 Aug 27 15:29 hosts
drwxr-x--- 14 root root  4096 Aug 27 15:29 host_vars

Additional information

No response

jean-christophe-manciot avatar Aug 28 '24 14:08 jean-christophe-manciot