Uploaded image for project: 'Automation Hub'
  1. Automation Hub
  2. AAH-2629

BUG - Collection not showing in Automation UI and not able to be deleted through the API

Details

    • Bug
    • Resolution: Unresolved
    • Undefined
    • None
    • 2.4
    • hub, Pulp
    • False
    • Hide

      None

      Show
      None
    • False
    • Moderate

    Description

      Description

      $ ansible-galaxy collection publish ansible-posix-1.5.4.tar.gz 
      Publishing collection artifact '/tmp/tmp.pk7a88e0YQ/ansible-posix-1.5.4.tar.gz' to published https://$AUTOMATION_HUB_FQDN/api/galaxy/
      ERROR! Error when publishing collection to published (https://$AUTOMATION_HUB_FQDN/api/galaxy/) (HTTP Code: 400, Message: Artifact already exists Code: invalid)
      

      Customer is receiving the above error message when trying to push a collection to Automation Hub. The caveat is that this specific version cannot be found anywhere within the UI of Automation Hub. It can only be found within the API and even then, there doesn't appear to be a way to delete it.

      Goal the customer is trying to accomplish:

      • Publish collections to the published repository skipping the approval step (think auto-approve)

      Automation Hub and component versions:

      {
          "available_versions": {
              "v3": "v3/",
              "pulp-v3": "pulp/api/v3/"
          },
          "server_version": "4.7.1",
          "galaxy_ng_version": "4.7.1",
          "galaxy_ng_commit": "",
          "galaxy_importer_version": "0.4.10",
          "pulp_core_version": "3.23.2",
          "pulp_ansible_version": "0.17.0",
          "pulp_container_version": "2.14.5",
          "aap_version": "2.4"
      }
      

      Steps to Reproduce

      • Create a new instance of Automation Hub 4.7
      • Make sure to set GALAXY_REQUIRE_CONTENT_APPROVAL: false in /etc/pulp/settings.py
      • In the Automation Hub UI,
      • Go to Collections -> Namespaces and create a namespace called ansible
      • Go to Collections -> Repositories -> published -> Copy CLI configuration and copy-paste the output to a local ansible.cfg file
      • Go to Collections -> API token to create a token and copy-paste the value into the local ansible.cfg file where token= is.
      • Finally, add a validate_certs = False right below token. The file should look like the following.
        [galaxy]
        server_list = published
      
        [galaxy_server.published]
        url=https://$AUTOMATION_HUB_FQDN/api/galaxy/
        token=$API_TOKEN
        validate_certs=False
        
      • Download the latest version of the ansible.posix collection from https://galaxy.ansible.com/ansible/posix
      • Run the following command to publish the collection to Automation Hub. This will publish the collection to Automation Hub and will need to be approved.
          ansible-galaxy collection publish /path/to/ansible-posix-$VERSION.tar.gz
          
      • In the Automation Hub UI, go to Collections -> Approval and approve the collection. This move the collection into the published repository and thus viewable to all users of Automation Hub.
      • In the Automation Hub UI,
      • Go to Collections -> Collections and delete the newly uploaded ansible.posix collection
      • Go to Collections -> Repositories -> published -> Edit and change the pipeline from Approved to None
      • Re-publish the collection using same command (see above)
      • Search for the collection in the Automation Hub UI

      Actual Behavior

      After performing the steps above, the uploaded collection is missing from the UI. It can be found by going to the following API endpoint (https://$AUTOMATION_HUB_FQDN/api/galaxy/pulp/api/v3/content/ansible/collection_versions/). Users are not able to delete it via normal methods nor through HTTP DELETE requests. If they try sending HTTP DELETE to https://$AUTOMATION_HUB_FQDN/api/galaxy/pulp/api/v3/artifacts/$ARTIFACT_ID/, they end up with the following error message:

      {"detail":"The Artifact cannot be deleted because it is associated with Content."}
      

      There is a chance that sending a HTTP DELETE request to https://$AUTOMATION_HUB_FQDN/api/galax/pulp/api/v3/orphans/ will delete it but it doesn't always work.

      Regardless, it appears there is a scenario where a collection version can wind up on Automation Hub in a not ideal state.

      Expected Behavior

      See *goal* in the description. The customer would like to be able to publish a collection to the published repository without having to go through the approval step. Methods used above were done by the customer and I. It left Automation Hub in a not ideal state. I would like to focus this bug report on how a collection can be left in a not-ideal state (present in the filesystem/database but not visible in the UI) and thus prevent the usage of the specific collection version.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rhn-support-mmitschk Max Mitschke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: