pulp-ansible 0.25.0__py3-none-any.whl → 0.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pulp_ansible/app/__init__.py +1 -1
- pulp_ansible/app/migrations/0060_remove_collectionversion_unique_is_highest_and_more.py +23 -0
- pulp_ansible/app/migrations/0061_collectionversion_new_tags.py +24 -0
- pulp_ansible/app/models.py +9 -18
- pulp_ansible/app/serializers.py +11 -1
- pulp_ansible/app/settings.py +1 -1
- pulp_ansible/app/tasks/collections.py +8 -2
- pulp_ansible/app/viewsets.py +10 -2
- {pulp_ansible-0.25.0.dist-info → pulp_ansible-0.26.0.dist-info}/METADATA +1 -1
- {pulp_ansible-0.25.0.dist-info → pulp_ansible-0.26.0.dist-info}/RECORD +14 -12
- {pulp_ansible-0.25.0.dist-info → pulp_ansible-0.26.0.dist-info}/WHEEL +1 -1
- {pulp_ansible-0.25.0.dist-info → pulp_ansible-0.26.0.dist-info}/entry_points.txt +0 -0
- {pulp_ansible-0.25.0.dist-info → pulp_ansible-0.26.0.dist-info}/licenses/LICENSE +0 -0
- {pulp_ansible-0.25.0.dist-info → pulp_ansible-0.26.0.dist-info}/top_level.txt +0 -0
pulp_ansible/app/__init__.py
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.2.16 on 2024-11-21 08:53
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
from pulpcore.plugin.migrations import RequireVersion
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
("ansible", "0059_collectionversion_unique_sha256"),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
RequireVersion("ansible", "0.23.0"),
|
|
15
|
+
migrations.RemoveConstraint(
|
|
16
|
+
model_name="collectionversion",
|
|
17
|
+
name="unique_is_highest",
|
|
18
|
+
),
|
|
19
|
+
migrations.RemoveField(
|
|
20
|
+
model_name="collectionversion",
|
|
21
|
+
name="is_highest",
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by Django 4.2.19 on 2025-05-21 12:04
|
|
2
|
+
|
|
3
|
+
import django.contrib.postgres.fields
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
("ansible", "0060_remove_collectionversion_unique_is_highest_and_more"),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AddField(
|
|
15
|
+
model_name="collectionversion",
|
|
16
|
+
name="new_tags",
|
|
17
|
+
field=django.contrib.postgres.fields.ArrayField(
|
|
18
|
+
base_field=models.CharField(max_length=64, unique=True),
|
|
19
|
+
db_column="tags",
|
|
20
|
+
null=True,
|
|
21
|
+
size=None,
|
|
22
|
+
),
|
|
23
|
+
),
|
|
24
|
+
]
|
pulp_ansible/app/models.py
CHANGED
|
@@ -6,7 +6,6 @@ from semantic_version import Version
|
|
|
6
6
|
|
|
7
7
|
from django.conf import settings
|
|
8
8
|
from django.db import models
|
|
9
|
-
from django.db.models import UniqueConstraint, Q
|
|
10
9
|
from django.db.utils import IntegrityError
|
|
11
10
|
from django.contrib.postgres import fields as psql_fields
|
|
12
11
|
from django.contrib.postgres import search as psql_search
|
|
@@ -150,10 +149,6 @@ class CollectionVersion(Content):
|
|
|
150
149
|
repository (models.CharField): The URL of the originating SCM repository.
|
|
151
150
|
version (models.CharField): The version of the collection.
|
|
152
151
|
requires_ansible (models.CharField): The version of Ansible required to use the collection.
|
|
153
|
-
is_highest (models.BooleanField): Indicates that the version is the highest one
|
|
154
|
-
in the collection. Import and sync workflows update this field, which then
|
|
155
|
-
triggers the database to [re]build the search_vector.
|
|
156
|
-
This field is Deprecated and scheduled for removal as soon as 0.24.0.
|
|
157
152
|
|
|
158
153
|
Relations:
|
|
159
154
|
|
|
@@ -188,23 +183,26 @@ class CollectionVersion(Content):
|
|
|
188
183
|
version_patch = models.IntegerField()
|
|
189
184
|
version_prerelease = models.CharField(max_length=128)
|
|
190
185
|
|
|
191
|
-
# This field is deprecated. We keep it for some releases for 0-Downtime upgrades.
|
|
192
|
-
is_highest = models.BooleanField(editable=False, default=False)
|
|
193
|
-
|
|
194
186
|
# Foreign Key Fields
|
|
195
187
|
collection = models.ForeignKey(
|
|
196
188
|
Collection, on_delete=models.PROTECT, related_name="versions", editable=False
|
|
197
189
|
)
|
|
198
190
|
tags = models.ManyToManyField(Tag, editable=False)
|
|
191
|
+
# -----
|
|
192
|
+
# Upgrade steps (spaced out by releases):
|
|
193
|
+
# 1. Add new field and start populating in current code also.
|
|
194
|
+
# 2. Migrate remaining entries and delete m2m table.
|
|
195
|
+
# Rename python field name without changing db_column.
|
|
196
|
+
new_tags = psql_fields.ArrayField(
|
|
197
|
+
models.CharField(max_length=64, unique=True), null=True, db_column="tags"
|
|
198
|
+
)
|
|
199
199
|
|
|
200
200
|
# Search Fields
|
|
201
201
|
# This field is populated by a trigger setup in the database by
|
|
202
202
|
# a migration file. The trigger only runs when the table is
|
|
203
203
|
# updated. CollectionVersions are INSERT'ed into the table, so
|
|
204
204
|
# the search_vector does not get populated at initial creation
|
|
205
|
-
# time.
|
|
206
|
-
# back and forth, which causes an UPDATE operation and then the
|
|
207
|
-
# search_vector is built.
|
|
205
|
+
# time.
|
|
208
206
|
search_vector = psql_search.SearchVectorField(default="")
|
|
209
207
|
|
|
210
208
|
@hook(BEFORE_SAVE)
|
|
@@ -232,13 +230,6 @@ class CollectionVersion(Content):
|
|
|
232
230
|
class Meta:
|
|
233
231
|
default_related_name = "%(app_label)s_%(model_name)s"
|
|
234
232
|
unique_together = ("sha256",)
|
|
235
|
-
constraints = [
|
|
236
|
-
UniqueConstraint(
|
|
237
|
-
fields=("collection", "is_highest"),
|
|
238
|
-
name="unique_is_highest",
|
|
239
|
-
condition=Q(is_highest=True),
|
|
240
|
-
),
|
|
241
|
-
]
|
|
242
233
|
|
|
243
234
|
|
|
244
235
|
class CollectionVersionMark(Content):
|
pulp_ansible/app/serializers.py
CHANGED
|
@@ -379,6 +379,7 @@ class TagSerializer(serializers.ModelSerializer):
|
|
|
379
379
|
A serializer for the Tag model.
|
|
380
380
|
"""
|
|
381
381
|
|
|
382
|
+
name = serializers.CharField(help_text=_("The name of the Tag."), read_only=True)
|
|
382
383
|
count = serializers.IntegerField(read_only=True)
|
|
383
384
|
|
|
384
385
|
class Meta:
|
|
@@ -518,6 +519,8 @@ class CollectionVersionUploadSerializer(SingleArtifactContentUploadSerializer):
|
|
|
518
519
|
)
|
|
519
520
|
# repository field clashes
|
|
520
521
|
collection_info["origin_repository"] = collection_info.pop("repository", None)
|
|
522
|
+
# Remove this once new_tags is properly named tags
|
|
523
|
+
collection_info["new_tags"] = collection_info["tags"]
|
|
521
524
|
data.update(collection_info)
|
|
522
525
|
|
|
523
526
|
return data
|
|
@@ -640,7 +643,7 @@ class CollectionVersionSerializer(ContentChecksumSerializer, CollectionVersionUp
|
|
|
640
643
|
read_only=True,
|
|
641
644
|
)
|
|
642
645
|
|
|
643
|
-
tags =
|
|
646
|
+
tags = serializers.SerializerMethodField()
|
|
644
647
|
|
|
645
648
|
version = serializers.CharField(
|
|
646
649
|
help_text=_("The version of the collection."), max_length=128, read_only=True
|
|
@@ -658,6 +661,13 @@ class CollectionVersionSerializer(ContentChecksumSerializer, CollectionVersionUp
|
|
|
658
661
|
|
|
659
662
|
creating = True
|
|
660
663
|
|
|
664
|
+
@extend_schema_field(serializers.ListField(child=TagNestedSerializer()))
|
|
665
|
+
def get_tags(self, obj):
|
|
666
|
+
if obj.new_tags is None:
|
|
667
|
+
return [{"name": tag.name} for tag in obj.tags.all()]
|
|
668
|
+
else:
|
|
669
|
+
return [{"name": tag} for tag in obj.new_tags]
|
|
670
|
+
|
|
661
671
|
def validate(self, data):
|
|
662
672
|
"""Run super() validate if creating, else return data."""
|
|
663
673
|
# This validation is for creating CollectionVersions
|
pulp_ansible/app/settings.py
CHANGED
|
@@ -338,6 +338,9 @@ def create_collection_from_importer(importer_result):
|
|
|
338
338
|
Do not perform any database operations, just return an unsaved CollectionVersion.
|
|
339
339
|
"""
|
|
340
340
|
collection_info = importer_result["metadata"]
|
|
341
|
+
|
|
342
|
+
# Remove, once the new_tags is properly named tags
|
|
343
|
+
collection_info["new_tags"] = collection_info["tags"]
|
|
341
344
|
tags = collection_info.pop("tags")
|
|
342
345
|
|
|
343
346
|
# Remove fields not used by this model
|
|
@@ -848,9 +851,11 @@ class CollectionSyncFirstStage(Stage):
|
|
|
848
851
|
@staticmethod
|
|
849
852
|
def _get_response_next_value(api_version, response):
|
|
850
853
|
if api_version == 2:
|
|
851
|
-
return response
|
|
854
|
+
return response.get("next")
|
|
855
|
+
elif links := response.get("links"):
|
|
856
|
+
return links.get("next")
|
|
852
857
|
else:
|
|
853
|
-
return
|
|
858
|
+
return None
|
|
854
859
|
|
|
855
860
|
def _collection_list_downloader(self, api_version, collection_endpoint, page_num, page_size):
|
|
856
861
|
if api_version == 2:
|
|
@@ -1213,6 +1218,7 @@ class AnsibleContentSaver(ContentSaver):
|
|
|
1213
1218
|
|
|
1214
1219
|
# Get tags for saving in _post_save
|
|
1215
1220
|
tags = info.pop("tags")
|
|
1221
|
+
info["new_tags"] = tags
|
|
1216
1222
|
d_content.extra_data["tags"] = tags
|
|
1217
1223
|
|
|
1218
1224
|
# Update with the additional data from the Collection
|
pulp_ansible/app/viewsets.py
CHANGED
|
@@ -1199,8 +1199,16 @@ class TagViewSet(NamedModelViewSet, mixins.ListModelMixin):
|
|
|
1199
1199
|
serializer_class = TagSerializer
|
|
1200
1200
|
|
|
1201
1201
|
def get_queryset(self):
|
|
1202
|
-
|
|
1203
|
-
|
|
1202
|
+
if CollectionVersion.objects.filter(new_tags__isnull=True).exists():
|
|
1203
|
+
qs = super().get_queryset().annotate(count=Count("ansible_collectionversion"))
|
|
1204
|
+
else:
|
|
1205
|
+
qs = (
|
|
1206
|
+
CollectionVersion.objects.all()
|
|
1207
|
+
.annotate(tag=Func(F("new_tags"), function="unnest"))
|
|
1208
|
+
.values("tag")
|
|
1209
|
+
.values(count=Count("pk"), name=F("tag"))
|
|
1210
|
+
)
|
|
1211
|
+
return qs
|
|
1204
1212
|
|
|
1205
1213
|
|
|
1206
1214
|
class CopyViewSet(viewsets.ViewSet):
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
pulp_ansible/__init__.py,sha256=WXL3JyOZzh4tALN4OBNgqj412O2LXVr8iYSn14Av0_o,67
|
|
2
2
|
pulp_ansible/pytest_plugin.py,sha256=1x_Nb39VqNmI8KMEA4RS0fkvOPpkpp-7Dwzo9mjvyJQ,8763
|
|
3
|
-
pulp_ansible/app/__init__.py,sha256=
|
|
3
|
+
pulp_ansible/app/__init__.py,sha256=AYbbkZO6YRQBv5cIzcYOABuzncw31SIQaTnedqBiUmo,279
|
|
4
4
|
pulp_ansible/app/constants.py,sha256=cRrWMbJU-v1nCY2CjmGTOFGzz5aggn4ZKIs4-zeYADQ,78
|
|
5
5
|
pulp_ansible/app/downloaders.py,sha256=0xrAXzhTMJ6ywvs6XyYNAKvRzYb_UZR6A5_WgaHvuiE,8331
|
|
6
6
|
pulp_ansible/app/fields.py,sha256=yV3FL-47K-nxbiBxgzWi1hk3tfLsRdgic59LiwT2Fvs,624
|
|
7
7
|
pulp_ansible/app/global_access_conditions.py,sha256=ayV_LbQIa4ReuDYQycdDY7WysfGk-e0gbuDGhAQFWyY,1235
|
|
8
8
|
pulp_ansible/app/logutils.py,sha256=My4XivZMYLKeJqPHFwk3pIZSGlspALhI93vZxwWzlSY,846
|
|
9
9
|
pulp_ansible/app/modelresource.py,sha256=Kqhmhd53JPfOthoOzLPxN1TnGERJBFckvwQoJfaIKnw,7839
|
|
10
|
-
pulp_ansible/app/models.py,sha256=
|
|
11
|
-
pulp_ansible/app/serializers.py,sha256=
|
|
12
|
-
pulp_ansible/app/settings.py,sha256=
|
|
10
|
+
pulp_ansible/app/models.py,sha256=eXaG2lquynKF4bHiu4-hkospiMHqjnykkz8_9mMe6sE,22112
|
|
11
|
+
pulp_ansible/app/serializers.py,sha256=ibfkvuUmfPooODs562KJ65iB7iEYexbmJepKsE7yQPQ,35925
|
|
12
|
+
pulp_ansible/app/settings.py,sha256=M9OdR-EiHjmskVCGHBjHkBMts66kx4F22sS2dgb7YAw,1186
|
|
13
13
|
pulp_ansible/app/urls.py,sha256=PM-kGhBX7eQTJgsomUCxbIUHpIhyVZCyDUywQ21KAxU,8443
|
|
14
14
|
pulp_ansible/app/utils.py,sha256=ClI_WvVy73kOZQB2mS8Gftf80Vye7pOxrbodTmPQgmk,1686
|
|
15
|
-
pulp_ansible/app/viewsets.py,sha256=
|
|
15
|
+
pulp_ansible/app/viewsets.py,sha256=WFMLIP9Y90C4FpaQz1Snmo1XvkyCIezGm3Qr1j6MprE,44684
|
|
16
16
|
pulp_ansible/app/galaxy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
pulp_ansible/app/galaxy/mixins.py,sha256=GY0nwZRqTBTCJUOgUDTNwlTbRa6NHN5dFEP9fI5dxCg,1391
|
|
18
18
|
pulp_ansible/app/galaxy/serializers.py,sha256=47ORFSvPxBBjii5Y2_0EaoNJFMlKVOwFZd5MHXWSZds,1211
|
|
@@ -87,11 +87,13 @@ pulp_ansible/app/migrations/0056_collectionversion_sha256.py,sha256=6gLDAEcULJag
|
|
|
87
87
|
pulp_ansible/app/migrations/0057_collectionversion_sha256_migrate.py,sha256=VnFl99Wywslr53VKwfd6RNBB5HEBaUCsqX0awEVOkMU,2395
|
|
88
88
|
pulp_ansible/app/migrations/0058_fix_0056_regression.py,sha256=VTmiG_VlpC6wXb4R28TDC4rbd1KLTuPItgzcrq0R28w,1021
|
|
89
89
|
pulp_ansible/app/migrations/0059_collectionversion_unique_sha256.py,sha256=_4MAElCkv5OUjv7v9eL43h9PhtLl85vOfMiTZKEGD-Q,1291
|
|
90
|
+
pulp_ansible/app/migrations/0060_remove_collectionversion_unique_is_highest_and_more.py,sha256=GDaBq6YPznAxjObBmP3YRHsdUtUjTAHpnShpkICe9J8,586
|
|
91
|
+
pulp_ansible/app/migrations/0061_collectionversion_new_tags.py,sha256=Hkf5oaJU7N-LQGi7IFXIx_SSx-FatS1kKYOfFEMCzlc,655
|
|
90
92
|
pulp_ansible/app/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
93
|
pulp_ansible/app/schema/__init__.py,sha256=eGi2QVJ0kJgXwiDNjQsvqWDSr3EA8TFqFZATTY8xwT8,207
|
|
92
94
|
pulp_ansible/app/schema/copy_config.json,sha256=AJz8riON7_rh-L7jM5iev2Imc5UKjlNvGfwF7KrFH7Y,568
|
|
93
95
|
pulp_ansible/app/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
94
|
-
pulp_ansible/app/tasks/collections.py,sha256=
|
|
96
|
+
pulp_ansible/app/tasks/collections.py,sha256=ShU35zNkjgVs7cdjZfSZuiixtWNrP2m7-a8-rGZxy7w,50990
|
|
95
97
|
pulp_ansible/app/tasks/collectionversion_index.py,sha256=_cnQeWRpFXrreTJM9aaEc2HuknTksZa0lLZ7XUfmQ_c,9401
|
|
96
98
|
pulp_ansible/app/tasks/copy.py,sha256=dO_DnLT5hck6GpZomEHurrDHJM0Wkh2B0_wgHHOtbuY,5563
|
|
97
99
|
pulp_ansible/app/tasks/deletion.py,sha256=f-VNTMzDMQiJpCLN34fY5gwhAGlh3RACj4VWc_tOaP0,3579
|
|
@@ -160,9 +162,9 @@ pulp_ansible/tests/unit/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
|
160
162
|
pulp_ansible/tests/unit/migrations/conftest.py,sha256=61n56aJuwEuAcUS27xnmnEDx6Ie7M5zxh851doWm7Ok,438
|
|
161
163
|
pulp_ansible/tests/unit/migrations/test_0057_collection_version_sha256_migrate.py,sha256=NmU-frZNO1qHvhdxfw-bwPTEkqN4Wdc3dEs9dWME47o,2174
|
|
162
164
|
pulp_ansible/tests/unit/migrations/test_x_repo_search_migration.py,sha256=IrC_V_Gss4nqhkdL-60upcEzGcz8IsiI2d-MfUtFY-g,657
|
|
163
|
-
pulp_ansible-0.
|
|
164
|
-
pulp_ansible-0.
|
|
165
|
-
pulp_ansible-0.
|
|
166
|
-
pulp_ansible-0.
|
|
167
|
-
pulp_ansible-0.
|
|
168
|
-
pulp_ansible-0.
|
|
165
|
+
pulp_ansible-0.26.0.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
|
|
166
|
+
pulp_ansible-0.26.0.dist-info/METADATA,sha256=c_bafNYgQgiH1d8X5peDi1SoTzIBfjuXVFLcxqKx-lE,3207
|
|
167
|
+
pulp_ansible-0.26.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
168
|
+
pulp_ansible-0.26.0.dist-info/entry_points.txt,sha256=6PFqCdT7Yn7U5MlioYRsyyWbJDcZI2aAJuzc7yXHqGk,119
|
|
169
|
+
pulp_ansible-0.26.0.dist-info/top_level.txt,sha256=5Rrg5DSM_F9wH8vu8Fxjb5EmroC-I8RVKp05fhXH6kQ,13
|
|
170
|
+
pulp_ansible-0.26.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|