-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a resource that works pretty much the same as compose-rpms. It allows import compose images and getting the same data back. The old import API is still available, but marked as deprecated. Since the existing code did not store path for the images (just the filename), there are two migrations to get to the desired state. After applying the migrations, all data will be preserved, only the previously existing images will have an empty path. JIRA: PDC-911
- Loading branch information
Showing
8 changed files
with
197 additions
and
33 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 |
---|---|---|
@@ -1,26 +1,36 @@ | ||
[ | ||
{ | ||
"model": "compose.Path", | ||
"pk": 1, | ||
"fields": { | ||
"path": "path/to/images" | ||
} | ||
}, | ||
{ | ||
"model": "compose.ComposeImage", | ||
"pk": 1, | ||
"fields": { | ||
"variant_arch": 1, | ||
"image": 1 | ||
"image": 1, | ||
"path": 1 | ||
} | ||
}, | ||
{ | ||
"model": "compose.ComposeImage", | ||
"pk": 2, | ||
"fields": { | ||
"variant_arch": 1, | ||
"image": 2 | ||
"image": 2, | ||
"path": 1 | ||
} | ||
}, | ||
{ | ||
"model": "compose.ComposeImage", | ||
"pk": 3, | ||
"fields": { | ||
"variant_arch": 1, | ||
"image": 3 | ||
"image": 3, | ||
"path": 1 | ||
} | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Copyright (c) 2015 Red Hat | ||
# Licensed under The MIT License (MIT) | ||
# http://opensource.org/licenses/MIT | ||
# | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('compose', '0003_auto_20150610_1338'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='composeimage', | ||
name='path', | ||
field=models.ForeignKey(to='compose.Path', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='path', | ||
name='path', | ||
field=models.CharField(unique=True, max_length=4096, blank=True), | ||
), | ||
] |
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,32 @@ | ||
# | ||
# Copyright (c) 2015 Red Hat | ||
# Licensed under The MIT License (MIT) | ||
# http://opensource.org/licenses/MIT | ||
# | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
def set_empty_path(apps, schema_editor): | ||
path, _ = apps.get_model('compose', 'Path').objects.get_or_create(path='') | ||
for compose_image in apps.get_model('compose', 'ComposeImage').objects.filter(path=None): | ||
compose_image.path = path | ||
compose_image.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('compose', '0004_auto_20150819_0826'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(set_empty_path), | ||
migrations.AlterField( | ||
model_name='composeimage', | ||
name='path', | ||
field=models.ForeignKey(to='compose.Path'), | ||
), | ||
] |
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
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