-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Advisory package sum_type will be stored as INT as createrepo_c uses it. Upload will translate supported checksum from str to int. User will still see a string representation of sum_type. closes #6442 https://pulp.plan.io/issues/6442
- Loading branch information
1 parent
4ec3c7e
commit b8c42dd
Showing
6 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Save advisory packages' sum_type as integer as createrepo_c uses. Still showed to user as a string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
pulp_rpm/app/migrations/0007_advisory_pkg_sumtype_as_int.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 2.2.11 on 2020-04-06 16:05 | ||
|
||
from django.db import migrations, models, transaction | ||
|
||
|
||
def translate_sum_type(apps, schema_editor): | ||
# use sum_type as int as createrepo_c uses | ||
with transaction.atomic(): | ||
UpdateCollectionPackage = apps.get_model('rpm', 'UpdateCollectionPackage') | ||
update_collection_package_to_save = [] | ||
for package in UpdateCollectionPackage.objects.all(): | ||
package.sum_type_temp = int(package.sum_type) if package.sum_type else None | ||
update_collection_package_to_save.append(package) | ||
UpdateCollectionPackage.objects.bulk_update( | ||
update_collection_package_to_save, | ||
['sum_type_temp'] | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('rpm', '0006_opensuse_support'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='updatecollectionpackage', | ||
name='sum_type_temp', | ||
field=models.PositiveIntegerField( | ||
null=True, default=None | ||
) | ||
), | ||
migrations.RunPython(translate_sum_type), | ||
migrations.RemoveField( | ||
model_name='updatecollectionpackage', | ||
name='sum_type' | ||
), | ||
migrations.RenameField( | ||
model_name='updatecollectionpackage', | ||
old_name='sum_type_temp', | ||
new_name='sum_type' | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters