pulpcore 3.84.0__py3-none-any.whl → 3.85.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.

Potentially problematic release.


This version of pulpcore might be problematic. Click here for more details.

Files changed (163) hide show
  1. pulp_certguard/app/__init__.py +1 -1
  2. pulp_certguard/app/models.py +7 -26
  3. pulp_certguard/app/serializers.py +0 -2
  4. pulp_certguard/rhsm/__init__.py +4 -0
  5. pulp_certguard/rhsm/rhsm_check_path.py +198 -0
  6. pulp_certguard/tests/unit/certdata.py +249 -0
  7. pulp_certguard/tests/unit/test_rhsm_check_path.py +213 -0
  8. pulp_file/app/__init__.py +1 -1
  9. pulp_file/app/migrations/0001_initial_squashed_0016_add_domain.py +0 -20
  10. pulp_file/app/migrations/0017_alter_filealternatecontentsource_alternatecontentsource_ptr_and_more.py +1 -1
  11. pulpcore/app/apps.py +2 -12
  12. pulpcore/app/entrypoint.py +22 -22
  13. pulpcore/app/migrations/0001_squashed_0090_char_to_text_field.py +0 -95
  14. pulpcore/app/migrations/0091_systemid.py +1 -1
  15. pulp_file/app/migrations/0006_delete_filefilesystemexporter.py → pulpcore/app/migrations/0136_delete_basedistribution.py +3 -3
  16. pulpcore/app/migrations/0137_appstatus.py +33 -0
  17. pulpcore/app/migrations/0138_vulnerabilityreport.py +33 -0
  18. pulpcore/app/models/__init__.py +4 -1
  19. pulpcore/app/models/publication.py +0 -41
  20. pulpcore/app/models/status.py +145 -0
  21. pulpcore/app/models/task.py +1 -0
  22. pulpcore/app/models/vulnerability_report.py +34 -0
  23. pulpcore/app/serializers/__init__.py +1 -0
  24. pulpcore/app/serializers/content.py +13 -1
  25. pulpcore/app/serializers/repository.py +8 -1
  26. pulpcore/app/serializers/vulnerability_report.py +27 -0
  27. pulpcore/app/settings.py +14 -47
  28. pulpcore/app/tasks/__init__.py +2 -0
  29. pulpcore/app/tasks/vulnerability_report.py +159 -0
  30. pulpcore/app/viewsets/__init__.py +1 -0
  31. pulpcore/app/viewsets/vulnerability_report.py +20 -0
  32. pulpcore/constants.py +4 -0
  33. pulpcore/content/__init__.py +23 -22
  34. pulpcore/content/handler.py +5 -2
  35. pulpcore/migrations.py +38 -11
  36. pulpcore/openapi/__init__.py +8 -0
  37. pulpcore/plugin/models/__init__.py +2 -0
  38. pulpcore/plugin/serializers/__init__.py +2 -0
  39. pulpcore/plugin/tasking.py +2 -0
  40. pulpcore/plugin/viewsets/__init__.py +2 -0
  41. pulpcore/pytest_plugin.py +21 -21
  42. pulpcore/tasking/worker.py +38 -35
  43. pulpcore/tests/functional/api/test_auth.py +18 -3
  44. pulpcore/tests/functional/api/test_openapi_schema.py +32 -15
  45. pulpcore/tests/functional/api/using_plugin/test_checkpoint.py +23 -1
  46. pulpcore/tests/functional/api/using_plugin/test_proxy.py +1 -1
  47. pulpcore/tests/unit/content/test_heartbeat.py +11 -8
  48. pulpcore/tests/unit/test_vulnerability_report.py +74 -0
  49. {pulpcore-3.84.0.dist-info → pulpcore-3.85.0.dist-info}/METADATA +12 -17
  50. {pulpcore-3.84.0.dist-info → pulpcore-3.85.0.dist-info}/RECORD +54 -152
  51. pulp_certguard/app/utils.py +0 -28
  52. pulp_certguard/tests/unit/test_models.py +0 -9
  53. pulp_file/app/migrations/0001_initial.py +0 -59
  54. pulp_file/app/migrations/0002_file_related_names.py +0 -55
  55. pulp_file/app/migrations/0003_auto_20191014_1721.py +0 -18
  56. pulp_file/app/migrations/0004_filefilesystemexporter.py +0 -21
  57. pulp_file/app/migrations/0005_filerepository.py +0 -24
  58. pulp_file/app/migrations/0007_filefilesystemexporter.py +0 -25
  59. pulp_file/app/migrations/0008_add_manifest_field.py +0 -19
  60. pulp_file/app/migrations/0009_move_data_to_new_master_distribution_model.py +0 -77
  61. pulp_file/app/migrations/0010_auto_publish.py +0 -23
  62. pulp_file/app/migrations/0011_fix_auto_publish.py +0 -36
  63. pulp_file/app/migrations/0012_delete_filefilesystemexporter.py +0 -28
  64. pulp_file/app/migrations/0013_file_acs.py +0 -24
  65. pulp_file/app/migrations/0014_new_rbac_permissions.py +0 -33
  66. pulp_file/app/migrations/0015_allow_null_manifest.py +0 -23
  67. pulp_file/app/migrations/0016_add_domain.py +0 -25
  68. pulpcore/app/migrations/0001_initial.py +0 -451
  69. pulpcore/app/migrations/0002_increase_artifact_size_field.py +0 -18
  70. pulpcore/app/migrations/0003_remove_upload_completed.py +0 -17
  71. pulpcore/app/migrations/0004_add_duplicated_reserved_resources.py +0 -45
  72. pulpcore/app/migrations/0005_progressreport_code.py +0 -19
  73. pulpcore/app/migrations/0006_repository_plugin_managed.py +0 -18
  74. pulpcore/app/migrations/0007_delete_progress_proxies.py +0 -19
  75. pulpcore/app/migrations/0008_published_metadata_as_content.py +0 -44
  76. pulpcore/app/migrations/0009_remove_task_non_fatal_errors.py +0 -17
  77. pulpcore/app/migrations/0010_pulp_fields.py +0 -570
  78. pulpcore/app/migrations/0011_relative_path.py +0 -28
  79. pulpcore/app/migrations/0012_auto_20191104_2000.py +0 -31
  80. pulpcore/app/migrations/0013_repository_pulp_type.py +0 -18
  81. pulpcore/app/migrations/0014_remove_repository_plugin_managed.py +0 -17
  82. pulpcore/app/migrations/0015_auto_20191112_1426.py +0 -33
  83. pulpcore/app/migrations/0016_charfield_to_textfield.py +0 -68
  84. pulpcore/app/migrations/0017_remove_task_parent.py +0 -17
  85. pulpcore/app/migrations/0018_auto_20191127_2350.py +0 -20
  86. pulpcore/app/migrations/0019_add_signing_service_model.py +0 -27
  87. pulpcore/app/migrations/0020_change_publishedartifact_constraints.py +0 -17
  88. pulpcore/app/migrations/0021_add_signing_service_foreign_key.py +0 -24
  89. pulpcore/app/migrations/0022_rename_last_version.py +0 -27
  90. pulpcore/app/migrations/0023_change_exporter_models.py +0 -82
  91. pulpcore/app/migrations/0024_use_local_storage_for_uploads.py +0 -19
  92. pulpcore/app/migrations/0025_task_parent_task.py +0 -19
  93. pulpcore/app/migrations/0026_task_group.py +0 -32
  94. pulpcore/app/migrations/0027_export_backend.py +0 -31
  95. pulpcore/app/migrations/0028_import_importer_pulpimporter_pulpimporterrepository.py +0 -85
  96. pulpcore/app/migrations/0029_export_delete.py +0 -19
  97. pulpcore/app/migrations/0030_taskgroup_all_tasks_dispatched.py +0 -24
  98. pulpcore/app/migrations/0031_import_export_validate_params.py +0 -19
  99. pulpcore/app/migrations/0032_export_to_chunks.py +0 -27
  100. pulpcore/app/migrations/0033_increase_remote_artifact_size_field.py +0 -18
  101. pulpcore/app/migrations/0034_groupprogressreport.py +0 -32
  102. pulpcore/app/migrations/0035_content_upstream_id.py +0 -18
  103. pulpcore/app/migrations/0036_unprotect_last_export.py +0 -19
  104. pulpcore/app/migrations/0037_pulptemporaryfile.py +0 -28
  105. pulpcore/app/migrations/0038_repository_remote.py +0 -19
  106. pulpcore/app/migrations/0039_change_download_concurrency.py +0 -25
  107. pulpcore/app/migrations/0040_set_admin_is_staff.py +0 -28
  108. pulpcore/app/migrations/0041_accesspolicy.py +0 -29
  109. pulpcore/app/migrations/0042_rbac_for_tasks.py +0 -56
  110. pulpcore/app/migrations/0043_toc_attribute.py +0 -19
  111. pulpcore/app/migrations/0044_temp_file_artifact_field.py +0 -20
  112. pulpcore/app/migrations/0045_accesspolicy_permissions_allow_null.py +0 -19
  113. pulpcore/app/migrations/0046_task__resource_job_id.py +0 -35
  114. pulpcore/app/migrations/0047_improve_orphan_cleanup.py +0 -59
  115. pulpcore/app/migrations/0048_fips_checksums.py +0 -38
  116. pulpcore/app/migrations/0049_add_file_field_to_uploadchunk.py +0 -24
  117. pulpcore/app/migrations/0050_namespace_access_policies.py +0 -28
  118. pulpcore/app/migrations/0051_timeoutfields.py +0 -34
  119. pulpcore/app/migrations/0052_tasking_logging_cid.py +0 -18
  120. pulpcore/app/migrations/0053_remote_headers.py +0 -19
  121. pulpcore/app/migrations/0054_add_public_key.py +0 -104
  122. pulpcore/app/migrations/0055_label.py +0 -31
  123. pulpcore/app/migrations/0056_remote_rate_limit.py +0 -18
  124. pulpcore/app/migrations/0057_add_label_indexes.py +0 -23
  125. pulpcore/app/migrations/0058_accesspolicy_customized.py +0 -18
  126. pulpcore/app/migrations/0059_proxy_creds.py +0 -23
  127. pulpcore/app/migrations/0060_data_migration_proxy_creds.py +0 -45
  128. pulpcore/app/migrations/0061_call_handle_artifact_checksums_command.py +0 -87
  129. pulpcore/app/migrations/0062_add_new_distribution_mastermodel.py +0 -36
  130. pulpcore/app/migrations/0063_repository_retained_versions.py +0 -18
  131. pulpcore/app/migrations/0064_add_new_style_task_columns.py +0 -109
  132. pulpcore/app/migrations/0064_repository_user_hidden.py +0 -18
  133. pulpcore/app/migrations/0065_merge_20210615_1211.py +0 -14
  134. pulpcore/app/migrations/0066_download_concurrency_and_retry_changes.py +0 -24
  135. pulpcore/app/migrations/0067_add_protect_to_task_reservation.py +0 -19
  136. pulpcore/app/migrations/0068_add_timestamp_of_interest.py +0 -23
  137. pulpcore/app/migrations/0069_update_json_fields.py +0 -63
  138. pulpcore/app/migrations/0070_rename_retained_versions.py +0 -18
  139. pulpcore/app/migrations/0071_filesystemexport_filesystemexporter.py +0 -35
  140. pulpcore/app/migrations/0072_add_method_to_filesystem_exporter.py +0 -18
  141. pulpcore/app/migrations/0073_encrypt_remote_fields.py +0 -139
  142. pulpcore/app/migrations/0074_acs.py +0 -47
  143. pulpcore/app/migrations/0075_rbaccontentguard.py +0 -25
  144. pulpcore/app/migrations/0076_remove_reserved_resource.py +0 -39
  145. pulpcore/app/migrations/0077_move_remote_url_credentials.py +0 -41
  146. pulpcore/app/migrations/0078_grouprole_role_userrole.py +0 -70
  147. pulpcore/app/migrations/0079_rename_permissions_assignment_accesspolicy_creation_hooks.py +0 -18
  148. pulpcore/app/migrations/0080_proxy_group_model.py +0 -37
  149. pulpcore/app/migrations/0081_reapplabel_group_permissions.py +0 -59
  150. pulpcore/app/migrations/0082_add_manage_roles_permissions.py +0 -17
  151. pulpcore/app/migrations/0083_alter_group_options.py +0 -17
  152. pulpcore/app/migrations/0084_alter_rbaccontentguard_options.py +0 -17
  153. pulpcore/app/migrations/0085_contentredirectcontentguard.py +0 -26
  154. pulpcore/app/migrations/0086_task_json_fields.py +0 -77
  155. pulpcore/app/migrations/0087_taskschedule.py +0 -34
  156. pulpcore/app/migrations/0088_accesspolicy_queryset_scoping.py +0 -18
  157. pulpcore/app/migrations/0089_alter_contentredirectcontentguard_options.py +0 -17
  158. pulpcore/app/migrations/0090_char_to_text_field.py +0 -79
  159. pulpcore/tests/unit/migration/test_0077_move_remote_url_credentials.py +0 -35
  160. {pulpcore-3.84.0.dist-info → pulpcore-3.85.0.dist-info}/WHEEL +0 -0
  161. {pulpcore-3.84.0.dist-info → pulpcore-3.85.0.dist-info}/entry_points.txt +0 -0
  162. {pulpcore-3.84.0.dist-info → pulpcore-3.85.0.dist-info}/licenses/LICENSE +0 -0
  163. {pulpcore-3.84.0.dist-info → pulpcore-3.85.0.dist-info}/top_level.txt +0 -0
@@ -1,31 +0,0 @@
1
- # Generated by Django 2.2.17 on 2021-01-05 21:18
2
-
3
- from django.db import migrations, models
4
- import django.db.models.deletion
5
- import django_lifecycle.mixins
6
- import uuid
7
-
8
-
9
- class Migration(migrations.Migration):
10
-
11
- dependencies = [
12
- ('contenttypes', '0002_remove_content_type_name'),
13
- ('core', '0054_add_public_key'),
14
- ]
15
-
16
- operations = [
17
- migrations.CreateModel(
18
- name='Label',
19
- fields=[
20
- ('pulp_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
21
- ('object_id', models.UUIDField()),
22
- ('key', models.CharField(max_length=200)),
23
- ('value', models.TextField(null=True)),
24
- ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
25
- ],
26
- options={
27
- 'unique_together': {('content_type', 'object_id', 'key')},
28
- },
29
- bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
30
- ),
31
- ]
@@ -1,18 +0,0 @@
1
- # Generated by Django 2.2.17 on 2021-01-27 18:49
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0055_label'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='remote',
15
- name='rate_limit',
16
- field=models.IntegerField(null=True),
17
- ),
18
- ]
@@ -1,23 +0,0 @@
1
- # Generated by Django 2.2.17 on 2021-01-29 19:17
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0056_remote_rate_limit'),
10
- ]
11
-
12
- operations = [
13
- migrations.AlterField(
14
- model_name='label',
15
- name='key',
16
- field=models.CharField(db_index=True, max_length=200),
17
- ),
18
- migrations.AlterField(
19
- model_name='label',
20
- name='value',
21
- field=models.TextField(db_index=True, null=True),
22
- ),
23
- ]
@@ -1,18 +0,0 @@
1
- # Generated by Django 2.2.18 on 2021-02-02 21:35
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0057_add_label_indexes'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='accesspolicy',
15
- name='customized',
16
- field=models.BooleanField(default=False),
17
- ),
18
- ]
@@ -1,23 +0,0 @@
1
- # Generated by Django 2.2.18 on 2021-03-03 10:58
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0058_accesspolicy_customized'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='remote',
15
- name='proxy_password',
16
- field=models.TextField(null=True),
17
- ),
18
- migrations.AddField(
19
- model_name='remote',
20
- name='proxy_username',
21
- field=models.TextField(null=True),
22
- ),
23
- ]
@@ -1,45 +0,0 @@
1
- # Generated by Django 2.2.18 on 2021-03-03 10:59
2
-
3
- import contextlib
4
-
5
- from urllib.parse import urlparse, urlunparse
6
-
7
- from django.db import migrations
8
-
9
-
10
- def move_proxy_creds_up(apps, schema_editor):
11
- Remote = apps.get_model('core', 'Remote')
12
- for remote in Remote.objects.all():
13
- if remote.proxy_url and "@" in remote.proxy_url:
14
- with contextlib.suppress(Exception):
15
- parsed_url = urlparse(remote.proxy_url)
16
- netloc = parsed_url.netloc
17
- auth, url = netloc.rsplit("@", maxsplit=1)
18
- remote.proxy_username, remote.proxy_password = auth.split(":", maxsplit=1)
19
- remote.proxy_url = urlunparse(parsed_url._replace(netloc=url))
20
- remote.save()
21
-
22
-
23
- def move_proxy_creds_down(apps, schema_editor):
24
- Remote = apps.get_model('core', 'Remote')
25
- for remote in Remote.objects.all():
26
- if remote.proxy_url and remote.proxy_username and remote.proxy_password:
27
- with contextlib.suppress(Exception):
28
- parsed_url = urlparse(remote.proxy_url)
29
- url = parsed_url.netloc
30
- netloc = remote.proxy_username + ":" + remote.proxy_password + "@" + url
31
- remote.proxy_username = None
32
- remote.proxy_password = None
33
- remote.proxy_url = urlunparse(parsed_url._replace(netloc=netloc))
34
- remote.save()
35
-
36
-
37
- class Migration(migrations.Migration):
38
-
39
- dependencies = [
40
- ('core', '0059_proxy_creds'),
41
- ]
42
-
43
- operations = [
44
- migrations.RunPython(move_proxy_creds_up, reverse_code=move_proxy_creds_down, elidable=True),
45
- ]
@@ -1,87 +0,0 @@
1
- # Generated by Django 2.2.19 on 2021-03-05 18:35
2
- import logging
3
- import os
4
- from gettext import gettext as _
5
-
6
- from django.conf import settings
7
- from django.db import migrations
8
-
9
- from pulpcore import constants
10
- from pulpcore.app import pulp_hashlib
11
-
12
- CHUNK_SIZE = 1024 * 1024 # 1 Mb
13
-
14
- _logger = logging.getLogger(__name__)
15
-
16
-
17
- def handle_artifact_checksums(apps):
18
- Artifact = apps.get_model("core", "Artifact")
19
- paths = []
20
-
21
- # set allowed checksums
22
- for checksum in settings.ALLOWED_CONTENT_CHECKSUMS:
23
- params = {f"{checksum}__isnull": True}
24
- artifacts_qs = Artifact.objects.filter(**params)
25
- artifacts = []
26
- for a in artifacts_qs.iterator():
27
- hasher = pulp_hashlib.new(checksum)
28
- try:
29
- for chunk in a.file.chunks(CHUNK_SIZE):
30
- hasher.update(chunk)
31
- a.file.close()
32
- setattr(a, checksum, hasher.hexdigest())
33
- artifacts.append(a)
34
- except FileNotFoundError:
35
- file_path = os.path.join(settings.MEDIA_ROOT, a.file.name)
36
- paths.append(file_path)
37
-
38
- if len(artifacts) >= 1000:
39
- Artifact.objects.bulk_update(objs=artifacts, fields=[checksum], batch_size=1000)
40
- artifacts.clear()
41
-
42
- if artifacts:
43
- Artifact.objects.bulk_update(objs=artifacts, fields=[checksum], batch_size=1000)
44
-
45
- if paths:
46
- _logger.warning(
47
- (
48
- "Missing files needed to update artifact {checksum} checksum: {paths}. "
49
- "Please run 'pulpcore-manager handle-artifact-checksums'."
50
- ).format(checksum=checksum, paths=paths)
51
- )
52
-
53
- # unset any forbidden checksums
54
- forbidden_checksums = set(constants.ALL_KNOWN_CONTENT_CHECKSUMS).difference(
55
- settings.ALLOWED_CONTENT_CHECKSUMS
56
- )
57
- for checksum in forbidden_checksums:
58
- search_params = {f"{checksum}__isnull": False}
59
- update_params = {f"{checksum}": None}
60
- artifacts_qs = Artifact.objects.filter(**search_params)
61
- if artifacts_qs.exists():
62
- artifacts_qs.update(**update_params)
63
-
64
-
65
- def run_handle_artifact_checksums(apps, schema_editor):
66
- try:
67
- handle_artifact_checksums(apps)
68
- except Exception as exc:
69
- _logger.warning(
70
- (
71
- "Failed to update checksums for artifacts: {}. "
72
- "Please run 'pulpcore-manager handle-artifact-checksums'."
73
- ).format(exc)
74
- )
75
-
76
-
77
- class Migration(migrations.Migration):
78
-
79
- dependencies = [
80
- ("core", "0060_data_migration_proxy_creds"),
81
- ]
82
-
83
- operations = [
84
- migrations.RunPython(
85
- run_handle_artifact_checksums, reverse_code=run_handle_artifact_checksums, elidable=True
86
- ),
87
- ]
@@ -1,36 +0,0 @@
1
- # Generated by Django 2.2.19 on 2021-03-19 15:20
2
-
3
- from django.db import migrations, models
4
- import django.db.models.deletion
5
- import django_lifecycle.mixins
6
- import uuid
7
-
8
-
9
- class Migration(migrations.Migration):
10
-
11
- dependencies = [
12
- ('core', '0061_call_handle_artifact_checksums_command'),
13
- ]
14
-
15
- operations = [
16
- migrations.CreateModel(
17
- name='Distribution',
18
- fields=[
19
- ('pulp_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
20
- ('pulp_created', models.DateTimeField(auto_now_add=True)),
21
- ('pulp_last_updated', models.DateTimeField(auto_now=True, null=True)),
22
- ('pulp_type', models.TextField(db_index=True, default=None)),
23
- ('name', models.TextField(db_index=True, unique=True)),
24
- ('base_path', models.TextField(unique=True)),
25
- ('content_guard', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.ContentGuard')),
26
- ('publication', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Publication')),
27
- ('remote', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Remote')),
28
- ('repository', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Repository', related_name='distributions')),
29
- ('repository_version', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.RepositoryVersion')),
30
- ],
31
- options={
32
- 'abstract': False,
33
- },
34
- bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
35
- ),
36
- ]
@@ -1,18 +0,0 @@
1
- # Generated by Django 2.2.20 on 2021-04-14 14:44
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0062_add_new_distribution_mastermodel'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='repository',
15
- name='retained_versions',
16
- field=models.PositiveIntegerField(default=None, null=True),
17
- ),
18
- ]
@@ -1,109 +0,0 @@
1
- # Generated by Django 2.2.20 on 2021-04-27 07:51
2
-
3
- import django.contrib.postgres.fields
4
- import django.contrib.postgres.fields.jsonb
5
- from django.db import migrations, models
6
-
7
- TASK_BATCH_SIZE = 1000
8
-
9
-
10
- def copy_reserved_resources_record(apps, schema_editor):
11
- Task = apps.get_model('core', 'Task')
12
-
13
- # Update _reserved_resource_record for all tasks, 1000 tasks at a time.
14
- # When we hit 1K tasks, go to the db for the batch.
15
- # Make sure to update the final batch!
16
- tasks = []
17
- for task in Task.objects.iterator(chunk_size=TASK_BATCH_SIZE):
18
- task._reserved_resources_record = list(task.reserved_resources_record.values_list('resource', flat=True))
19
- tasks.append(task)
20
- if len(tasks) == TASK_BATCH_SIZE:
21
- Task.objects.bulk_update(tasks, ["_reserved_resources_record"])
22
- tasks.clear()
23
-
24
- # Update last set of tasks
25
- if len(tasks) > 0:
26
- Task.objects.bulk_update(tasks, ["_reserved_resources_record"])
27
-
28
-
29
- def purge_reservedresources(apps, schema_editor):
30
- TaskReservedResource = apps.get_model('core', 'TaskReservedResource')
31
- TaskReservedResource.objects.all().delete()
32
-
33
- ReservedResource = apps.get_model('core', 'ReservedResource')
34
- ReservedResource.objects.all().delete()
35
-
36
-
37
- class Migration(migrations.Migration):
38
-
39
- dependencies = [
40
- ('core', '0063_repository_retained_versions'),
41
- ]
42
-
43
- operations = [
44
- # Purge any ReservedResource entries - if there are any, they're orphans
45
- migrations.RunPython(
46
- code=purge_reservedresources,
47
- reverse_code=migrations.RunPython.noop,
48
- elidable=True,
49
- ),
50
- # Update entities for the new task-system
51
- migrations.AddField(
52
- model_name='task',
53
- name='args',
54
- field=django.contrib.postgres.fields.jsonb.JSONField(null=True),
55
- ),
56
- migrations.AddField(
57
- model_name='task',
58
- name='kwargs',
59
- field=django.contrib.postgres.fields.jsonb.JSONField(null=True),
60
- ),
61
- migrations.AddField(
62
- model_name='task',
63
- name='_reserved_resources_record',
64
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=256), null=True, size=None),
65
- ),
66
- migrations.AlterField(
67
- model_name='task',
68
- name='_resource_job_id',
69
- field=models.UUIDField(null=True),
70
- ),
71
- migrations.AlterField(
72
- model_name='progressreport',
73
- name='state',
74
- field=models.TextField(choices=[('waiting', 'Waiting'), ('skipped', 'Skipped'), ('running', 'Running'), ('completed', 'Completed'), ('failed', 'Failed'), ('canceled', 'Canceled'), ('canceling', 'Canceling')], default='waiting'),
75
- ),
76
- migrations.AlterField(
77
- model_name='task',
78
- name='state',
79
- field=models.TextField(choices=[('waiting', 'Waiting'), ('skipped', 'Skipped'), ('running', 'Running'), ('completed', 'Completed'), ('failed', 'Failed'), ('canceled', 'Canceled'), ('canceling', 'Canceling')]),
80
- ),
81
- migrations.AddIndex(
82
- model_name='task',
83
- index=models.Index(fields=['pulp_created'], name='core_task_pulp_cr_10223f_idx'),
84
- ),
85
- migrations.RunPython(
86
- code=copy_reserved_resources_record,
87
- reverse_code=migrations.RunPython.noop,
88
- ),
89
- migrations.RemoveField(
90
- model_name='taskreservedresourcerecord',
91
- name='resource',
92
- ),
93
- migrations.RemoveField(
94
- model_name='taskreservedresourcerecord',
95
- name='task',
96
- ),
97
- migrations.DeleteModel(
98
- name='ReservedResourceRecord',
99
- ),
100
- migrations.DeleteModel(
101
- name='TaskReservedResourceRecord',
102
- ),
103
- migrations.RenameField(
104
- model_name='task',
105
- old_name='_reserved_resources_record',
106
- new_name='reserved_resources_record',
107
- ),
108
-
109
- ]
@@ -1,18 +0,0 @@
1
- # Generated by Django 2.2.19 on 2021-04-01 14:48
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0063_repository_retained_versions'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='repository',
15
- name='user_hidden',
16
- field=models.BooleanField(default=False),
17
- ),
18
- ]
@@ -1,14 +0,0 @@
1
- # Generated by Django 2.2.24 on 2021-06-15 12:11
2
-
3
- from django.db import migrations
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0064_repository_user_hidden'),
10
- ('core', '0064_add_new_style_task_columns'),
11
- ]
12
-
13
- operations = [
14
- ]
@@ -1,24 +0,0 @@
1
- # Generated by Django 2.2.24 on 2021-06-13 03:14
2
-
3
- import django.core.validators
4
- from django.db import migrations, models
5
-
6
-
7
- class Migration(migrations.Migration):
8
-
9
- dependencies = [
10
- ('core', '0065_merge_20210615_1211'),
11
- ]
12
-
13
- operations = [
14
- migrations.AlterField(
15
- model_name='remote',
16
- name='download_concurrency',
17
- field=models.PositiveIntegerField(null=True, validators=[django.core.validators.MinValueValidator(1, 'Download concurrency must be at least 1')]),
18
- ),
19
- migrations.AddField(
20
- model_name='remote',
21
- name='max_retries',
22
- field=models.PositiveIntegerField(null=True),
23
- ),
24
- ]
@@ -1,19 +0,0 @@
1
- # Generated by Django 2.2.24 on 2021-06-21 19:20
2
-
3
- from django.db import migrations, models
4
- import django.db.models.deletion
5
-
6
-
7
- class Migration(migrations.Migration):
8
-
9
- dependencies = [
10
- ('core', '0066_download_concurrency_and_retry_changes'),
11
- ]
12
-
13
- operations = [
14
- migrations.AlterField(
15
- model_name='taskreservedresource',
16
- name='resource',
17
- field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.ReservedResource'),
18
- ),
19
- ]
@@ -1,23 +0,0 @@
1
- # Generated by Django 2.2.20 on 2021-05-07 18:01
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0067_add_protect_to_task_reservation'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='artifact',
15
- name='timestamp_of_interest',
16
- field=models.DateTimeField(auto_now=True),
17
- ),
18
- migrations.AddField(
19
- model_name='content',
20
- name='timestamp_of_interest',
21
- field=models.DateTimeField(auto_now=True),
22
- ),
23
- ]
@@ -1,63 +0,0 @@
1
- # Generated by Django 3.2.5 on 2021-07-21 17:00
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0068_add_timestamp_of_interest'),
10
- ]
11
-
12
- operations = [
13
- migrations.AlterField(
14
- model_name='accesspolicy',
15
- name='permissions_assignment',
16
- field=models.JSONField(null=True),
17
- ),
18
- migrations.AlterField(
19
- model_name='accesspolicy',
20
- name='statements',
21
- field=models.JSONField(),
22
- ),
23
- migrations.AlterField(
24
- model_name='export',
25
- name='params',
26
- field=models.JSONField(null=True),
27
- ),
28
- migrations.AlterField(
29
- model_name='import',
30
- name='params',
31
- field=models.JSONField(null=True),
32
- ),
33
- migrations.AlterField(
34
- model_name='pulpexport',
35
- name='output_file_info',
36
- field=models.JSONField(null=True),
37
- ),
38
- migrations.AlterField(
39
- model_name='pulpexport',
40
- name='toc_info',
41
- field=models.JSONField(null=True),
42
- ),
43
- migrations.AlterField(
44
- model_name='remote',
45
- name='headers',
46
- field=models.JSONField(blank=True, null=True),
47
- ),
48
- migrations.AlterField(
49
- model_name='task',
50
- name='args',
51
- field=models.JSONField(null=True),
52
- ),
53
- migrations.AlterField(
54
- model_name='task',
55
- name='error',
56
- field=models.JSONField(null=True),
57
- ),
58
- migrations.AlterField(
59
- model_name='task',
60
- name='kwargs',
61
- field=models.JSONField(null=True),
62
- ),
63
- ]
@@ -1,18 +0,0 @@
1
- # Generated by Django 2.2.24 on 2021-07-08 12:40
2
-
3
- from django.db import migrations
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0069_update_json_fields'),
10
- ]
11
-
12
- operations = [
13
- migrations.RenameField(
14
- model_name='repository',
15
- old_name='retained_versions',
16
- new_name='retain_repo_versions',
17
- ),
18
- ]
@@ -1,35 +0,0 @@
1
- # Generated by Django 2.2.23 on 2021-06-03 20:05
2
-
3
- from django.db import migrations, models
4
- import django.db.models.deletion
5
-
6
-
7
- class Migration(migrations.Migration):
8
-
9
- dependencies = [
10
- ('core', '0070_rename_retained_versions'),
11
- ]
12
-
13
- operations = [
14
- migrations.CreateModel(
15
- name='FilesystemExport',
16
- fields=[
17
- ('export_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Export')),
18
- ],
19
- options={
20
- 'abstract': False,
21
- },
22
- bases=('core.export',),
23
- ),
24
- migrations.CreateModel(
25
- name='FilesystemExporter',
26
- fields=[
27
- ('exporter_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='core_fs_exporter', serialize=False, to='core.Exporter')),
28
- ('path', models.TextField()),
29
- ],
30
- options={
31
- 'default_related_name': '%(app_label)s_fs_exporter',
32
- },
33
- bases=('core.exporter',),
34
- ),
35
- ]
@@ -1,18 +0,0 @@
1
- # Generated by Django 3.2.5 on 2021-08-04 17:49
2
-
3
- from django.db import migrations, models
4
-
5
-
6
- class Migration(migrations.Migration):
7
-
8
- dependencies = [
9
- ('core', '0071_filesystemexport_filesystemexporter'),
10
- ]
11
-
12
- operations = [
13
- migrations.AddField(
14
- model_name='filesystemexporter',
15
- name='method',
16
- field=models.CharField(choices=[('write', 'Export by writing'), ('hardlink', 'Export by hardlinking'), ('symlink', 'Export by symlinking')], default='write', max_length=128),
17
- ),
18
- ]