File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -984,7 +984,12 @@ def validate(self, data):
984984 }
985985 )
986986
987- if repository .PUSH_ENABLED :
987+ registry_push = repository .PUSH_ENABLED or (
988+ isinstance (repository , models .ContainerRepository )
989+ and not repository .remote
990+ and repository .distributions .exists ()
991+ )
992+ if registry_push :
988993 if "future_base_path" in data :
989994 raise serializers .ValidationError (
990995 {
Original file line number Diff line number Diff line change @@ -404,6 +404,7 @@ def test_push_matching_username(
404404
405405
406406def test_push_to_existing_regular_repository (
407+ add_to_cleanup ,
407408 container_repository_factory ,
408409 local_registry ,
409410 registry_client ,
@@ -422,6 +423,11 @@ def test_push_to_existing_regular_repository(
422423 tags = container_bindings .ContentTagsApi .list (repository_version = repository .latest_version_href )
423424 assert tags .count == 1
424425
426+ distribution = container_bindings .DistributionsContainerApi .list (name = "foo" ).results [0 ]
427+ add_to_cleanup (container_bindings .DistributionsContainerApi , distribution .pulp_href )
428+ namespace = container_bindings .PulpContainerNamespacesApi .read (distribution .namespace )
429+ add_to_cleanup (container_bindings .PulpContainerNamespacesApi , namespace .pulp_href )
430+
425431
426432def test_push_to_existing_push_repository (
427433 add_to_cleanup ,
Original file line number Diff line number Diff line change @@ -132,14 +132,14 @@ def test_rbac_repository_content(
132132 assert container_bindings .ContentTagsApi .list (repository_version = repository_rv ).count == 9
133133
134134 with user_reader2 :
135- assert container_bindings .ContentTagsApi .list ().count == 9
135+ assert container_bindings .ContentTagsApi .list ().count == 11
136136 assert (
137137 container_bindings .ContentTagsApi .list (repository_version = push_repository1_rv ).count
138- == 0
138+ == 1
139139 )
140140 assert (
141141 container_bindings .ContentTagsApi .list (repository_version = push_repository2_rv ).count
142- == 0
142+ == 1
143143 )
144144 assert container_bindings .ContentTagsApi .list (repository_version = repository_rv ).count == 9
145145
Original file line number Diff line number Diff line change @@ -440,7 +440,11 @@ def _container_push_repository_factory(**body):
440440 kwargs = {"name" : name }
441441 if "pulp_domain" in body :
442442 kwargs ["pulp_domain" ] = pulp_domain
443- return container_bindings .RepositoriesContainerPushApi .list (** kwargs ).results [0 ]
443+ # Orphan legacy push repos have no distribution until the first registry push.
444+ listed = container_bindings .RepositoriesContainerPushApi .list (** kwargs )
445+ if listed .results :
446+ return listed .results [0 ]
447+ return None
444448
445449 return _container_push_repository_factory
446450
You can’t perform that action at this time.
0 commit comments