Navigation Menu

Skip to content

Commit

Permalink
Adds additional d_artifact.remote check
Browse files Browse the repository at this point in the history
Not all d_artifact objects have remotes, e.g. the migration plugin does
not. Other places in the code account for this, but there is one area
that does not. This adds an additional check to one codepath that checks
for equality of `d_artifact.remote.pk` only if `d_artifact.remote`
exists.

closes #7876
  • Loading branch information
bmbouter committed Feb 16, 2021
1 parent a9a536a commit 2574527
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES/7876.bugfix
@@ -0,0 +1,2 @@
Fixed a bug experienced by the migration plugin where all content objects are assumed to have a
remote associated with them.
10 changes: 5 additions & 5 deletions pulpcore/plugin/stages/artifact_stages.py
Expand Up @@ -293,11 +293,11 @@ def _needed_remote_artifacts(self, batch):
raise ValueError(
msg.format(rp=content_artifact.relative_path, c=d_content.content)
)
for remote_artifact in content_artifact._remote_artifact_saver_ras:
if remote_artifact.remote_id == d_artifact.remote.pk:
break
else:
if d_artifact.remote:
if d_artifact.remote:
for remote_artifact in content_artifact._remote_artifact_saver_ras:
if remote_artifact.remote_id == d_artifact.remote.pk:
break
else:
remote_artifact = self._create_remote_artifact(d_artifact, content_artifact)
needed_ras.append(remote_artifact)
return needed_ras
Expand Down

0 comments on commit 2574527

Please sign in to comment.