pulp-gem 0.2.0__tar.gz → 0.4.0__tar.gz

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.
Files changed (65) hide show
  1. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/CHANGES.rst +35 -0
  2. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/PKG-INFO +1 -1
  3. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/__init__.py +2 -1
  4. pulp-gem-0.4.0/pulp_gem/app/migrations/0009_check_datarepair.py +25 -0
  5. pulp-gem-0.4.0/pulp_gem/app/migrations/0010_delete_shallowgemcontent.py +15 -0
  6. pulp-gem-0.4.0/pulp_gem/app/migrations/0011_alter_gemcontent_platform.py +17 -0
  7. pulp-gem-0.4.0/pulp_gem/app/migrations/0012_alter_gemdistribution_options_and_more.py +69 -0
  8. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/models.py +30 -44
  9. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/serializers.py +4 -29
  10. pulp-gem-0.4.0/pulp_gem/app/viewsets.py +480 -0
  11. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/api/test_crud_content_unit.py +27 -3
  12. pulp-gem-0.4.0/pulp_gem/tests/functional/api/test_domain.py +43 -0
  13. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/conftest.py +21 -10
  14. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/unit/test_serializers.py +8 -14
  15. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem.egg-info/PKG-INFO +1 -1
  16. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem.egg-info/SOURCES.txt +6 -6
  17. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem.egg-info/requires.txt +1 -1
  18. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/requirements.txt +1 -1
  19. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/setup.py +1 -1
  20. pulp-gem-0.2.0/pulp_gem/app/management/commands/datarepair-gemspec-platform.py +0 -64
  21. pulp-gem-0.2.0/pulp_gem/app/management/commands/datarepair-shallow-gems.py +0 -60
  22. pulp-gem-0.2.0/pulp_gem/app/viewsets.py +0 -159
  23. pulp-gem-0.2.0/pulp_gem/tests/__init__.py +0 -0
  24. pulp-gem-0.2.0/pulp_gem/tests/unit/__init__.py +0 -0
  25. pulp-gem-0.2.0/pulp_gem/tests/unit/test_models.py +0 -9
  26. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/COMMITMENT +0 -0
  27. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/COPYRIGHT +0 -0
  28. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/LICENSE +0 -0
  29. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/MANIFEST.in +0 -0
  30. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/README.md +0 -0
  31. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/functest_requirements.txt +0 -0
  32. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/__init__.py +0 -0
  33. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0001_initial.py +0 -0
  34. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0002_gemrepository.py +0 -0
  35. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0003_move_data_to_new_master_distribution_model.py +0 -0
  36. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0004_alter_gemcontent_content_ptr_and_more.py +0 -0
  37. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0005_rename_gemcontent_shallowgemcontent.py +0 -0
  38. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0006_gemremote_excludes_gemremote_includes_and_more.py +0 -0
  39. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0007_DATA_fix_prerelease.py +0 -0
  40. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/migrations/0008_gemcontent_platform.py +0 -0
  41. {pulp-gem-0.2.0/pulp_gem/app/management → pulp-gem-0.4.0/pulp_gem/app/migrations}/__init__.py +0 -0
  42. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/settings.py +0 -0
  43. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/tasks/__init__.py +0 -0
  44. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/tasks/publishing.py +0 -0
  45. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/app/tasks/synchronizing.py +0 -0
  46. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/specs.py +0 -0
  47. {pulp-gem-0.2.0/pulp_gem/app/management/commands → pulp-gem-0.4.0/pulp_gem/tests}/__init__.py +0 -0
  48. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/__init__.py +0 -0
  49. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/api/__init__.py +0 -0
  50. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/api/test_crud_remotes.py +0 -0
  51. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/api/test_download_content.py +0 -0
  52. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/api/test_publish.py +0 -0
  53. /pulp-gem-0.2.0/pulp_gem/tests/functional/api/test_full_mirror.py → /pulp-gem-0.4.0/pulp_gem/tests/functional/api/test_pull_through.py +0 -0
  54. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/api/test_sync.py +0 -0
  55. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/constants.py +0 -0
  56. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/functional/utils.py +0 -0
  57. {pulp-gem-0.2.0/pulp_gem/app/migrations → pulp-gem-0.4.0/pulp_gem/tests/unit}/__init__.py +0 -0
  58. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem/tests/unit/test_spec.py +0 -0
  59. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem.egg-info/dependency_links.txt +0 -0
  60. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem.egg-info/entry_points.txt +0 -0
  61. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pulp_gem.egg-info/top_level.txt +0 -0
  62. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/pyproject.toml +0 -0
  63. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/setup.cfg +0 -0
  64. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/test_requirements.txt +0 -0
  65. {pulp-gem-0.2.0 → pulp-gem-0.4.0}/unittest_requirements.txt +0 -0
@@ -13,6 +13,41 @@ Changelog
13
13
 
14
14
  .. towncrier release notes start
15
15
 
16
+ 0.4.0 (2023-11-03)
17
+ ==================
18
+
19
+ Features
20
+ --------
21
+
22
+ - Bumped pulpcore compatibility to 3.54.
23
+ `#40 <https://github.com/pulp/pulp_gem/issues/40>`__
24
+ - Added support for RBAC and domains.
25
+ `#154 <https://github.com/pulp/pulp_gem/issues/154>`__
26
+
27
+
28
+ Deprecations and Removals
29
+ -------------------------
30
+
31
+ - Removed pre 0.2 residua. When you are upgrading from <0.3, and your system was operated on <0.2 before, make sure you have run the corresponding datarepair commands before upgrading the codebase to this version.
32
+ `#143 <https://github.com/pulp/pulp_gem/issues/143>`__
33
+
34
+
35
+ ----
36
+
37
+
38
+ 0.3.0 (2023-09-18)
39
+ ==================
40
+
41
+ Deprecations and Removals
42
+ -------------------------
43
+
44
+ - Added a migration to tell admins to run certain datarepair commands before upgrading to 0.4.
45
+ `#141 <https://github.com/pulp/pulp_gem/issues/141>`__
46
+
47
+
48
+ ----
49
+
50
+
16
51
  0.2.0 (2023-08-15)
17
52
  ==================
18
53
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: pulp-gem
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Gemfile plugin for the Pulp Project
5
5
  Home-page: https://pulpproject.org/
6
6
  Author: Pulp Project Developers
@@ -6,5 +6,6 @@ class PulpGemPluginAppConfig(PulpPluginAppConfig):
6
6
 
7
7
  name = "pulp_gem.app"
8
8
  label = "gem"
9
- version = "0.2.0"
9
+ version = "0.4.0"
10
10
  python_package_name = "pulp-gem"
11
+ domain_compatible = True
@@ -0,0 +1,25 @@
1
+ # Generated by Django 4.2.1 on 2023-08-15 12:44
2
+
3
+ from django.db import migrations
4
+ from pulpcore.plugin.migrations import RequireVersion
5
+
6
+
7
+ def check_datarepair(apps, schema_editor):
8
+ ShallowGemContent = apps.get_model("gem", "ShallowGemContent")
9
+ if ShallowGemContent.objects.exists():
10
+ raise RuntimeError("Before continuing with this upgrade, you need to downgrade pulp_gem to ~=0.3, then run the 'datarepair-shallow-gems' command, or remove all remaining broken repository versions.")
11
+
12
+ GemContent = apps.get_model("gem", "GemContent")
13
+ if GemContent.objects.filter(platform=None).exists():
14
+ raise RuntimeError("Before continuing with this upgrade, you need to downgrade pulp_gem to ~=0.3, then run the 'datarepair-gemspec-platform' command, or remove all remaining broken repository versions.")
15
+
16
+
17
+ class Migration(migrations.Migration):
18
+ dependencies = [
19
+ ("gem", "0008_gemcontent_platform"),
20
+ ]
21
+
22
+ operations = [
23
+ RequireVersion("gem", "0.2.0"),
24
+ migrations.RunPython(code=check_datarepair, reverse_code=migrations.RunPython.noop, elidable=True),
25
+ ]
@@ -0,0 +1,15 @@
1
+ # Generated by Django 4.2.4 on 2023-09-12 10:56
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ ("gem", "0009_check_datarepair"),
9
+ ]
10
+
11
+ operations = [
12
+ migrations.DeleteModel(
13
+ name="ShallowGemContent",
14
+ ),
15
+ ]
@@ -0,0 +1,17 @@
1
+ # Generated by Django 4.2.4 on 2023-09-12 11:04
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ ("gem", "0010_delete_shallowgemcontent"),
9
+ ]
10
+
11
+ operations = [
12
+ migrations.AlterField(
13
+ model_name="gemcontent",
14
+ name="platform",
15
+ field=models.TextField(),
16
+ ),
17
+ ]
@@ -0,0 +1,69 @@
1
+ # Generated by Django 4.2.4 on 2023-10-04 10:25
2
+
3
+ from django.db import migrations, models
4
+ import django.db.models.deletion
5
+ import pulpcore.app.util
6
+
7
+
8
+ class Migration(migrations.Migration):
9
+ dependencies = [
10
+ ("core", "0110_apiappstatus"),
11
+ ("gem", "0011_alter_gemcontent_platform"),
12
+ ]
13
+
14
+ operations = [
15
+ migrations.AlterModelOptions(
16
+ name="gemdistribution",
17
+ options={
18
+ "default_related_name": "%(app_label)s_%(model_name)s",
19
+ "permissions": [
20
+ ("manage_roles_gemdistribution", "Can manage roles on gem distributions")
21
+ ],
22
+ },
23
+ ),
24
+ migrations.AlterModelOptions(
25
+ name="gempublication",
26
+ options={
27
+ "default_related_name": "%(app_label)s_%(model_name)s",
28
+ "permissions": [
29
+ ("manage_roles_gempublication", "Can manage roles on gem publications")
30
+ ],
31
+ },
32
+ ),
33
+ migrations.AlterModelOptions(
34
+ name="gemremote",
35
+ options={
36
+ "default_related_name": "%(app_label)s_%(model_name)s",
37
+ "permissions": [("manage_roles_gemremote", "Can manage roles on gem remotes")],
38
+ },
39
+ ),
40
+ migrations.AlterModelOptions(
41
+ name="gemrepository",
42
+ options={
43
+ "default_related_name": "%(app_label)s_%(model_name)s",
44
+ "permissions": [
45
+ ("sync_gemrepository", "Can start a sync task"),
46
+ ("modify_gemrepository", "Can modify content of the repository"),
47
+ ("manage_roles_gemrepository", "Can manage roles on gem repositories"),
48
+ ("repair_gemrepository", "Can repair repository versions"),
49
+ ],
50
+ },
51
+ ),
52
+ migrations.AlterUniqueTogether(
53
+ name="gemcontent",
54
+ unique_together=set(),
55
+ ),
56
+ migrations.AddField(
57
+ model_name="gemcontent",
58
+ name="_pulp_domain",
59
+ field=models.ForeignKey(
60
+ default=pulpcore.app.util.get_domain_pk,
61
+ on_delete=django.db.models.deletion.PROTECT,
62
+ to="core.domain",
63
+ ),
64
+ ),
65
+ migrations.AlterUniqueTogether(
66
+ name="gemcontent",
67
+ unique_together={("_pulp_domain", "checksum")},
68
+ ),
69
+ ]
@@ -6,12 +6,14 @@ from django.contrib.postgres.fields import HStoreField
6
6
  from django.db import models
7
7
 
8
8
  from pulpcore.plugin.models import (
9
+ AutoAddObjPermsMixin,
9
10
  Content,
10
11
  Publication,
11
12
  Distribution,
12
13
  Remote,
13
14
  Repository,
14
15
  )
16
+ from pulpcore.plugin.util import get_domain_pk
15
17
 
16
18
  from pulp_gem.specs import analyse_gem
17
19
 
@@ -19,39 +21,6 @@ from pulp_gem.specs import analyse_gem
19
21
  log = getLogger(__name__)
20
22
 
21
23
 
22
- class ShallowGemContent(Content):
23
- """
24
- The "shallow-gem" content type.
25
-
26
- Content of this type represents a ruby gem file with its spec data.
27
- This is the old deprecated format that is only carried around for legacy installations.
28
-
29
- Fields:
30
- name (str): The name of the gem.
31
- version (str): The version of the gem.
32
-
33
- """
34
-
35
- TYPE = "shallow-gem"
36
-
37
- name = models.TextField(blank=False, null=False)
38
- version = models.TextField(blank=False, null=False)
39
-
40
- @property
41
- def relative_path(self):
42
- """The relative path this gem is stored under for the content app."""
43
- return f"gems/{self.name}-{self.version}.gem"
44
-
45
- @property
46
- def gemspec_path(self):
47
- """The path for this gem's gemspec for the content app."""
48
- return f"quick/Marshal.4.8/{self.name}-{self.version}.gemspec.rz"
49
-
50
- class Meta:
51
- default_related_name = "%(app_label)s_%(model_name)s"
52
- unique_together = ("name", "version")
53
-
54
-
55
24
  class GemContent(Content):
56
25
  """
57
26
  The "gem" content type.
@@ -63,12 +32,10 @@ class GemContent(Content):
63
32
  TYPE = "gem"
64
33
  repo_key_fields = ("name", "version", "platform")
65
34
 
35
+ _pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)
66
36
  name = models.TextField(blank=False, null=False)
67
37
  version = models.TextField(blank=False, null=False)
68
- # `null` on `platform is allowed for zero downtime upgrade from version 0.1.*.
69
- # Change this to `null=False` in a version no earlier than 0.3.0.
70
- # See also `ext_version` and the datarepair-gemspec-platform command.
71
- platform = models.TextField(blank=False, null=True)
38
+ platform = models.TextField(blank=False, null=False)
72
39
  checksum = models.CharField(max_length=64, null=False, db_index=True)
73
40
  prerelease = models.BooleanField(default=False)
74
41
  dependencies = HStoreField(default=dict)
@@ -89,7 +56,7 @@ class GemContent(Content):
89
56
  def ext_version(self):
90
57
  """The version for this gem with the appended platform if not "ruby"."""
91
58
  # Remove the `None` with the change to the platform column.
92
- if self.platform is None or self.platform == "ruby":
59
+ if self.platform == "ruby":
93
60
  platform_suffix = ""
94
61
  else:
95
62
  platform_suffix = f"-{self.platform}"
@@ -117,21 +84,28 @@ class GemContent(Content):
117
84
 
118
85
  class Meta:
119
86
  default_related_name = "%(app_label)s_%(model_name)s"
120
- unique_together = ("checksum",)
87
+ unique_together = (
88
+ "_pulp_domain",
89
+ "checksum",
90
+ )
121
91
 
122
92
 
123
- class GemDistribution(Distribution):
93
+ class GemDistribution(Distribution, AutoAddObjPermsMixin):
124
94
  """
125
95
  A Distribution for GemContent.
126
96
  """
127
97
 
128
98
  TYPE = "gem"
99
+ SERVE_FROM_PUBLICATION = True
129
100
 
130
101
  class Meta:
131
102
  default_related_name = "%(app_label)s_%(model_name)s"
103
+ permissions = [
104
+ ("manage_roles_gemdistribution", "Can manage roles on gem distributions"),
105
+ ]
132
106
 
133
107
 
134
- class GemPublication(Publication):
108
+ class GemPublication(Publication, AutoAddObjPermsMixin):
135
109
  """
136
110
  A Publication for GemContent.
137
111
  """
@@ -140,9 +114,12 @@ class GemPublication(Publication):
140
114
 
141
115
  class Meta:
142
116
  default_related_name = "%(app_label)s_%(model_name)s"
117
+ permissions = [
118
+ ("manage_roles_gempublication", "Can manage roles on gem publications"),
119
+ ]
143
120
 
144
121
 
145
- class GemRemote(Remote):
122
+ class GemRemote(Remote, AutoAddObjPermsMixin):
146
123
  """
147
124
  A Remote for GemContent.
148
125
  """
@@ -169,16 +146,25 @@ class GemRemote(Remote):
169
146
 
170
147
  class Meta:
171
148
  default_related_name = "%(app_label)s_%(model_name)s"
149
+ permissions = [
150
+ ("manage_roles_gemremote", "Can manage roles on gem remotes"),
151
+ ]
172
152
 
173
153
 
174
- class GemRepository(Repository):
154
+ class GemRepository(Repository, AutoAddObjPermsMixin):
175
155
  """
176
156
  A Repository for GemContent.
177
157
  """
178
158
 
179
159
  TYPE = "gem"
180
- CONTENT_TYPES = [GemContent, ShallowGemContent]
160
+ CONTENT_TYPES = [GemContent]
181
161
  REMOTE_TYPES = [GemRemote]
182
162
 
183
163
  class Meta:
184
164
  default_related_name = "%(app_label)s_%(model_name)s"
165
+ permissions = [
166
+ ("sync_gemrepository", "Can start a sync task"),
167
+ ("modify_gemrepository", "Can modify content of the repository"),
168
+ ("manage_roles_gemrepository", "Can manage roles on gem repositories"),
169
+ ("repair_gemrepository", "Can repair repository versions"),
170
+ ]
@@ -4,7 +4,6 @@ import tempfile
4
4
  import hashlib
5
5
  import os
6
6
 
7
- from django.db import IntegrityError
8
7
  from rest_framework.serializers import (
9
8
  BooleanField,
10
9
  CharField,
@@ -24,6 +23,7 @@ from pulpcore.plugin.serializers import (
24
23
  RepositorySerializer,
25
24
  SingleContentArtifactField,
26
25
  )
26
+ from pulpcore.plugin.util import get_domain_pk
27
27
 
28
28
  from pulp_gem.app.models import (
29
29
  GemContent,
@@ -127,34 +127,9 @@ class GemContentSerializer(MultipleArtifactContentSerializer):
127
127
  return data
128
128
 
129
129
  def retrieve(self, validated_data):
130
- return GemContent.objects.filter(checksum=validated_data["checksum"]).first()
131
-
132
- def create(self, validated_data):
133
- """Save the GemContent unit.
134
-
135
- This must be used inside a task that locks on the Artifact and if given, the repository.
136
- """
137
- repository = validated_data.pop("repository", None)
138
- content = self.retrieve(validated_data)
139
- if content is None:
140
- try:
141
- content = super().create(validated_data)
142
- except IntegrityError:
143
- content = self.retrieve(validated_data)
144
- if content is None:
145
- raise
146
- content.touch()
147
- else:
148
- content.touch()
149
-
150
- if repository:
151
- repository.cast()
152
- content_to_add = self.Meta.model.objects.filter(pk=content.pk)
153
-
154
- # create new repo version with uploaded package
155
- with repository.new_version() as new_version:
156
- new_version.add_content(content_to_add)
157
- return content
130
+ return GemContent.objects.filter(
131
+ _pulp_domain=get_domain_pk(), checksum=validated_data["checksum"]
132
+ ).first()
158
133
 
159
134
  class Meta:
160
135
  fields = MultipleArtifactContentSerializer.Meta.fields + (