Issue #8305

Updated by dalley 9 months ago

* Create a repository Some sequences of actions can result in ContentArtifacts that have neither an attached Artifact, nor an attached RemoteArtifact. All of the records exist, but the links between them are broken.

A reproducer script is attached (run with pytest). I stepped through the code
and on_demand remote, and sync them.
* Delete
saw that at the remote

The deletion
time of the Remote deletes the RemoteArtifacts, leaving behind ContentArtifact attached first publish, there were 2 remote artifacts correctly linked to neither Artifacts nor Remotes, making them effectively corrupted 2 content artifacts, and unpublishable.

~~~ python
# create repository,
0 artifacts. At the time of the second publish, there are 2 artifacts, 2 content artifacts, and 0 remote
remote = remote_api.create(gen_file_remote(policy='on_demand'))
repo = repo_api.create(gen_repo())

# sync
artifacts -- but the repository
repository_sync_data = RepositorySyncURL(remote=remote.pulp_href)
sync_response = repo_api.sync(repo.pulp_href, repository_sync_data)
task = monitor_task(sync_response.task)

# delete
content artifact foreign key does not point to the remote

# ^---- problem occurs here, now RemoteArtifacts deleted, now ContentArtifact
artifacts, as it is broken supposed to. This results in failure at publish time.

publish_response = publications_api.create({"repository_version": task.created_resources[0]})
This was encountered while running my new auto_publish tests on the Python plugin, because the Python plugin defaults to "on_demand" rather than "immediate". # boom publish failure But it is trivial to reproduce on master branch(es) using the file plugin.