Task #7175
Updated by pulpbot almost 3 years ago
**Ticket moved to GitHub**: "pulp/pulp_rpm/2252":https://github.com/pulp/pulp_rpm/issues/2252 ---- ### Motivation It's very confusing to list images (see section `images` ) and see only some of them, while having other images (from stage2 of treeinfo) on the main model, ~~~ { "pulp_href": "/pulp/api/v3/content/rpm/distribution_trees/b94bb596-4aa7-4920-938e-66360cbba652/", "header_version": "1.2", "release_name": "CentOS Linux", "release_short": "CentOS", "release_version": "8", "release_is_layered": false, "base_product_name": null, "base_product_short": null, "base_product_version": null, "arch": "x86_64", "build_timestamp": 1591654006.0, "instimage": null, <------------ instimage "mainimage": "images/install.img", <------------ mainimage "discnum": null, "totaldiscs": null, "addons": [], "checksums": [ { "path": "images/pxeboot/vmlinuz", "checksum": "sha256:151fb7b594cb096e25769688cc748eefafeea133894878271bf9c428dba2cc71" }, { "path": "images/pxeboot/initrd.img", "checksum": "sha256:dbffac7f93e35b936dfecc73cbf47e79f7c304fbd84b5df3aaf896ed695ec28e" }, { "path": "images/install.img", "checksum": "sha256:4807e94ec4bd55b02a0f217dd19d34a4824ab04466092dd3ff9ca4bb67e8c3b6" }, { "path": "images/efiboot.img", "checksum": "sha256:39659e208d746e1afc88784f12d8bbd58b074aafca4a65b70be877e22afb3936" }, { "path": "images/boot.iso", "checksum": "sha256:c67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c" } ], "images": [ { "name": "kernel", "path": "images/pxeboot/vmlinuz", "platforms": "x86_64, xen", "artifact": null }, { "name": "initrd", "path": "images/pxeboot/initrd.img", "platforms": "x86_64, xen", "artifact": null }, { "name": "efiboot.img", "path": "images/efiboot.img", "platforms": "x86_64", "artifact": null }, { "name": "boot.iso", "path": "images/boot.iso", "platforms": "x86_64", "artifact": null } ], "variants": [ { "variant_id": "BaseOS", "uid": "BaseOS", "name": "BaseOS", "type": "variant", "packages": "Packages", "source_packages": null, "source_repository": null, "debug_packages": null, "debug_repository": null, "identity": null }, { "variant_id": "AppStream", "uid": "AppStream", "name": "AppStream", "type": "variant", "packages": "AppStream/Packages", "source_packages": null, "source_repository": null, "debug_packages": null, "debug_repository": null, "identity": null } ] } ~~~ To reproduce sync http://mirror.linux.duke.edu/pub/centos/8/BaseOS/x86_64/kickstart/ The `images/install.img` is not present among images but it's a part of a DistributionTree model itself. It is also present in the contentartifact table and is published correctly. ``` pulp=> select * from rpm_image; pulp_id | pulp_created | pulp_last_updated | name | path | platforms | distribution_tree_id --------------------------------------+-------------------------------+-------------------------------+-------------+---------------------------+------------- +-------------------------------------- 6fed6e01-494a-4c77-9e1c-c85c07c9e48e | 2020-07-20 18:08:35.447812+00 | 2020-07-20 18:08:35.447826+00 | boot.iso | images/boot.iso | x86_64 | b94bb596-4aa7-4920-938e-66360cbba652 593b55a2-9474-437c-83ce-34b87885fa55 | 2020-07-20 18:08:35.447857+00 | 2020-07-20 18:08:35.447865+00 | efiboot.img | images/efiboot.img | x86_64 | b94bb596-4aa7-4920-938e-66360cbba652 82677b85-e707-4a28-affe-7a933cc48dbe | 2020-07-20 18:08:35.447889+00 | 2020-07-20 18:08:35.447896+00 | initrd | images/pxeboot/initrd.img | x86_64, xen | b94bb596-4aa7-4920-938e-66360cbba652 1d8d8515-3fc0-410d-ac02-6dd317dac708 | 2020-07-20 18:08:35.44792+00 | 2020-07-20 18:08:35.447927+00 | kernel | images/pxeboot/vmlinuz | x86_64, xen | b94bb596-4aa7-4920-938e-66360cbba652 (4 rows) ``` ``` pulp=> select * from core_contentartifact where content_id='b94bb596-4aa7-4920-938e-66360cbba652'; pulp_id | pulp_created | pulp_last_updated | relative_path | artifact_id | content_id --------------------------------------+-------------------------------+-------------------------------+---------------------------+--------------------------- -----------+-------------------------------------- 10ecfd6e-2046-4653-9313-508d4b112976 | 2020-07-20 18:08:35.414974+00 | 2020-07-20 18:08:35.41498+00 | .treeinfo | f8d285ea-c394-4da7-a0a4-40 e61b30f443 | b94bb596-4aa7-4920-938e-66360cbba652 0bdfcf83-6d44-43aa-a299-1844d2ccee44 | 2020-07-20 18:08:35.414996+00 | 2020-07-20 18:08:35.415002+00 | images/boot.iso | | b94bb596-4aa7-4920-938e-66360cbba652 52cd8187-02e5-4c3a-a56e-7bbb12b064f0 | 2020-07-20 18:08:35.415016+00 | 2020-07-20 18:08:35.415022+00 | images/efiboot.img | | b94bb596-4aa7-4920-938e-66360cbba652 f960003a-9cb5-4d19-a4b2-a72a0bcaa07d | 2020-07-20 18:08:35.415036+00 | 2020-07-20 18:08:35.415042+00 | images/pxeboot/initrd.img | | b94bb596-4aa7-4920-938e-66360cbba652 78d19586-663a-4de3-81d7-811d8490eaad | 2020-07-20 18:08:35.415056+00 | 2020-07-20 18:08:35.415062+00 | images/pxeboot/vmlinuz | | b94bb596-4aa7-4920-938e-66360cbba652 cd5c5408-f76e-482f-8cd3-8b941c412588 | 2020-07-20 18:08:35.415076+00 | 2020-07-20 18:08:35.415081+00 | images/install.img | | b94bb596-4aa7-4920-938e-66360cbba652 (6 rows) ``` ### Proposal * Have all images created as instances of the Image model. * Allow platfroms to be null for images like `mainimage` which are not tight to a platform. * Remove mainimage and instimage from the distribution tree model Data migration is needed to alter the schema and to create missing images.