https://pulp.plan.io/issues/8305
"on_demand" synced content (ContentArtifacts) reference RemoteArtifact rather than Artifact. Deleting the Remote used by the sync deletes all RemoteArtifacts referencing that Remote. Nothing prevents the deletion of the Remote even if doing so would invalidate the ContentArtifacts.
These ContentArtifacts are no longer downloadable, and no longer publishable, regardless of which repository they exist in, unless they have a second RemoteArtifact. If Content were copied between many repositories, then it is possible that deleting the remote could invalidate many repositories at once, or invalidate repositories far enough removed from the user's mind that they don't immediately encounter the issue.
(Still carries the problem that remote can be edited and break ContentArtifacts)
Add a constraint that enforces "artifact is not Null OR remote_artifact is not Null". Deleting the Remote would trigger the ConstraintViolation and fail.
Prevent deletion of the remote outright, but with an option to proceed by immediately downloading all content on remote deletion
Check that each content_artifact has at least one other remote artifact, then delete.
Relax the uniqueness constraint on remote names, and just mark "deleted" remotes as hidden and inaccessible from the API.
diff --git a/pulpcore/app/models/repository.py b/pulpcore/app/models/repository.py
index a42c3c136..d5b2b6e0b 100644
--- a/pulpcore/app/models/repository.py
+++ b/pulpcore/app/models/repository.py
@@ -242,7 +242,8 @@ class Remote(MasterModel):
),
)
- name = models.TextField(db_index=True, unique=True)
+ hidden = models.BooleanField(default=False)
+ name = models.TextField(db_index=True)
url = models.TextField()
@@ -391,6 +392,9 @@ class Remote(MasterModel):
class Meta:
default_related_name = "remotes"
+ constraints = [
+ models.UniqueConstraint(fields=['name'], condition=models.Q(hidden=False))
+ ]
https://docs.djangoproject.com/en/3.1/ref/models/constraints/#condition
Add a force flag to the DELETE call. If force is not specified, and the remote is referenced by either a repository or a remote artifact, the call will fail.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing