Skip to content

Creating a new collection repository triggers sync error (http500) from hub #1359

Description

@hobby65

Summary

When adding a custom repository to automation hub through configurationas code as follows:

  - name: custom
    description: Custom content repository
    distribution:
      name: custom
      state: present
    update: false
    wait: false
    state: present

The play fails on error.

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version

$ ansible-galaxy collection list
# /root/.ansible/collections/ansible_collections
Collection              Version     
----------------------- ------------
ansible.controller      4.7.11      
ansible.eda             2.11.0      
ansible.hub             1.0.6       
ansible.platform        2.6.20260504
ansible.utils           6.0.2       
community.general       12.6.0      
community.hashi_vault   7.1.0       
infra.aap_configuration 4.4.0       
# /usr/local/lib/python3.11/site-packages/ansible/_internal/ansible_collections
Collection              Version     
----------------------- ------------
ansible._protomatter    2.19.9      

ansible automation platform 2.6-8 (latest update)
  • ansible installation method: one of source, pip, OS package, EE

OS / ENVIRONMENT

RHEL 9.7

Desired Behavior

Expected behaviour: The collection repository is created and no sync is triggered (hence update: false), playbook not giving an error .

Actual Behavior

The play gives an error:

TASK [infra.aap_configuration.collect_async_status : Create/Update Collection repository sync community | Wait to finish the Repository sync] ***
changed: [aap_dev]
TASK [infra.aap_configuration.collect_async_status : Register value] ***********
ok: [aap_dev]
TASK [infra.aap_configuration.collect_async_status : Handle Async Job Failure] ***
skipping: [aap_dev]
TASK [infra.aap_configuration.collect_async_status : Create/Update Collection repository sync custom | Wait to finish the Repository sync] ***
[ERROR]: Task failed: Module failed: Start Sync error: The host sent back a server error: /api/galaxy/pulp/api/v3/repositories/ansible/ansible/019e4541-3116-77f4-80de-a99ebf0ccb3b/sync/: HTTP Error 500: Internal Server Error. Please check the logs and try again later
Origin: /root/.ansible/collections/ansible_collections/infra/aap_configuration/roles/collect_async_status/tasks/main.yml:5:7
3   no_log: "{{ cas_secure_logging }}"
4   block:
5     - name: "{{ cas_object_label }}"
        ^ column 7
fatal: [aap_dev]: FAILED! => {"ansible_job_id": "j331296292996.5968", "attempts": 1, "changed": false, "finished": true, "msg": "Start Sync error: The host sent back a server error: /api/galaxy/pulp/api/v3/repositories/ansible/ansible/019e4541-3116-77f4-80de-a99ebf0ccb3b/sync/: HTTP Error 500: Internal Server Error. Please check the logs and try again later", "results_file": "/opt/app-root/src/.ansible_async/j331296292996.5968", "started": true, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring
TASK [infra.aap_configuration.collect_async_status : Register value] ***********
ok: [aap_dev]
TASK [infra.aap_configuration.collect_async_status : Handle Async Job Failure] ***
included: /root/.ansible/collections/ansible_collections/infra/aap_configuration/roles/collect_async_status/tasks/handle_error.yml for aap_dev
TASK [infra.aap_configuration.collect_async_status : handle_error | Show error and stop execution] ***
[ERROR]: Task failed: Action failed: error: Start Sync error: The host sent back a server error: /api/galaxy/pulp/api/v3/repositories/ansible/ansible/019e4541-3116-77f4-80de-a99ebf0ccb3b/sync/: HTTP Error 500: Internal Server Error. Please check the logs and try again later
Origin: /root/.ansible/collections/ansible_collections/infra/aap_configuration/roles/collect_async_status/tasks/handle_error.yml:4:7
2 - name: handle_error | Handle Errors Block
3   block:
4     - name: handle_error | Show error and stop execution
        ^ column 7
fatal: [aap_dev]: FAILED! => {"changed": false, "msg": "error: Start Sync error: The host sent back a server error: /api/galaxy/pulp/api/v3/repositories/ansible/ansible/019e4541-3116-77f4-80de-a99ebf0ccb3b/sync/: HTTP Error 500: Internal Server Error. Please check the logs and try again later"}
TASK [infra.aap_configuration.hub_collection_repository_sync : Cleanup async results files] ***

Please give some details of what is actually happening.
Include a [minimum complete verifiable example] with:

---
- name: Configure rhaap platform base
  hosts: "{{ instance | default('localhost') }}"
  connection: local
  gather_facts: false
  vars:
     hub_collection_repositories:
       - name: community
          description: Community content repository
          remote: community
          update: true
          wait: false
          state: present
        - name: custom
          description: Custom content repository
          distribution:
            name: custom
            state: present
          update: false
          wait: false
          state: present


 pre_tasks:
    - name: Set rhaap facts
      ansible.builtin.set_fact:
        aap_hostname: "{{ hostname }}"
        aap_username: "{{ username }}"
        aap_password: "{{ password }}"
        aap_validate_certs: "{{ validate_certs }}"

  roles:
    - infra.aap_configuration.dispatch

See above error output

STEPS TO REPRODUCE

Use provided playbook with correct veraibles for your environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions