Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content_view_version_cleanup role fails with error 'slice indices must be integers or None or have an __index__ method' #1712

Closed
smeeus opened this issue Feb 23, 2024 · 0 comments · Fixed by #1713

Comments

@smeeus
Copy link
Contributor

smeeus commented Feb 23, 2024

SUMMARY

content_view_version_cleanup role fails with error 'slice indices must be integers or None or have an index method'

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible [core 2.15.9]
  config file = /home/local/COMMON/sme8401/ansible/tme-satellite/ansible.cfg
  configured module search path = ['/home/local/COMMON/sme8401/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/local/COMMON/sme8401/bin/ansible-venv-py39/lib64/python3.9/site-packages/ansible
  ansible collection location = /home/local/COMMON/sme8401/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/local/COMMON/sme8401/bin/ansible
  python version = 3.9.18 (main, Nov 16 2023, 02:13:35) [GCC [8.5.0 20210514](callto:8.5.0 20210514) (Red Hat [8.5.0-20.0.1](callto:8.5.0-20.0.1))] (/home/smeeus/bin/ansible-venv-py39/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
[smeeus@watson satellite]$ cat /home/smeeus/.ansible/collections/ansible_collections/theforeman/foreman/MANIFEST.json | grep version
  "version": "4.0.0",
KATELLO/FOREMAN VERSION
rubygem-katello-4.8.1-1.el8.noarch
foreman-3.6.1-1.el8.noarch
STEPS TO REPRODUCE
- name: "Cleanup Satellite content views"
  hosts: satellite
  tasks:
    - name: "Content Cleanup | Include theforeman.foreman.content_credentials role"
      ansible.builtin.import_role:
        name: theforeman.foreman.content_view_version_cleanup
      tags: [ "katello_cleanup" ]
EXPECTED RESULTS

Cleanup of unused content views

ACTUAL RESULTS
ansible-playbook -i inventories playbook-satellite-content.yml --diff --tags=katello_cleanup -e "foreman_cleanup_content=true" -e "foreman_content_view_version_cleanup_keep=0"
...
TASK [theforeman.foreman.content_view_version_cleanup : Delete unused composite content view versions] *******************************************************************************************************************************************************************
Friday 23 February 2024  11:27:52 +0100 (0:00:02.368)       0:00:10.594 *******
fatal: [satellite]: FAILED! => {"msg": "The conditional check '(__foreman_ccv.versions | rejectattr('environment_ids') | map(attribute='version') | reverse | list)[foreman_content_view_version_cleanup_keep:]' failed. The error was: Unexpected templating type error occurred on ({% if (__foreman_ccv.versions | rejectattr('environment_ids') | map(attribute='version') | reverse | list)[foreman_content_view_version_cleanup_keep:] %} True {% else %} False {% endif %}): slice indices must be integers or None or have an __index__ method. slice indices must be integers or None or have an __index__ method\n\nThe error appears to be in '/home/smeeus/.ansible/collections/ansible_collections/theforeman/foreman/roles/content_view_version_cleanup/tasks/main.yml': line 19, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Delete unused composite content view versions\"\n  ^ here\n"}
@evgeni evgeni linked a pull request Feb 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant