New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kickstart syncing #1427
Kickstart syncing #1427
Conversation
e9be1ca
to
8cb7e01
Compare
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
820f865
to
abc00cf
Compare
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
c43191c
to
8b5fbab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabricio-aguiar, thanks for adding this test.
6770f96
to
87ddb1c
Compare
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
| @@ -100,6 +102,70 @@ def test_rpm(self): | |||
| ) | |||
| self.assertDictEqual(get_added_content_summary(repo), {}) | |||
|
|
|||
| @unittest.skip("Kickstart fixture with wrong checksums") | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to put this because the fixture seems to be with the wrong checksums:
https://repos.fedorapeople.org/pulp/pulp/fixtures/rpm-kickstart/.treeinfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LiveOS/squashfs.img
- current = 158657d4ff270db50204ae70c2256ca1523ee4f3c23eeedbabc3f723b69163a2
- calculated = 30e14955ebf1352266dc2ff8067e68104607e750abb9d3b36582b8af909fcb58
images/pxeboot/initrd.img
- current = 094631a67f1766688dfcf4ec1f07ab0921100878736afc3cc1b31f69e7b517a1
- calculated = 30e14955ebf1352266dc2ff8067e68104607e750abb9d3b36582b8af909fcb58
images/pxeboot/upgrade.img
- current = bc884c1b4b520e57f81f3bf43156365d9ef651a47266b21e2c3d00b09e0da46b
- calculated = 30e14955ebf1352266dc2ff8067e68104607e750abb9d3b36582b8af909fcb58
images/pxeboot/vmlinuz
- current = 91052b444e73f3eebdb93d1fb1506597e96c92d8de9c1e3c3f36b07a57d0a18f
- calculated = 91052b444e73f3eebdb93d1fb1506597e96c92d8de9c1e3c3f36b07a57d0a18f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree the checksums are incorrect. In my own testing I found this also:
[bmbouter@localhost pulp_ansible]$ sha256sum ~/Downloads/squashfs.img
30e14955ebf1352266dc2ff8067e68104607e750abb9d3b36582b8af909fcb58 /home/bmbouter/Downloads/squashfs.img
e04b270
to
3bd69bf
Compare
pulp_rpm/app/models.py
Outdated
| content_artifact = ContentArtifact.objects.filter( | ||
| content=self.distribution_tree, | ||
| relative_path=self.path, | ||
| ).get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this property is fetched while the DistributionTree was sync'd with policy=on_demand I think this will fail here.
What motivates having this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it for linking Image and Artifact:
"images": [
{
"name": "initrd",
"path": "images/pxeboot/initrd.img",
"platforms": "x86_64, xen",
"artifact": {
"_href": "/pulp/api/v3/artifacts/d6ddfc54-fe44-485d-9c3a-834a35aa8675/",
"_created": "2019-09-03T16:06:16.263824Z",
"file": "artifact/56/47f05ec18958947d32874eeb788fa396a05d0bab7c1b71f112ceb7e9b31eee",
"size": 2097152,
"md5": "b2d1236c286a3c0704224fe4105eca49",
"sha1": "7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6",
"sha224": "7841241795c51351bb1b7dc7d41ea855eddf4143e8925c227490c390",
"sha256": "5647f05ec18958947d32874eeb788fa396a05d0bab7c1b71f112ceb7e9b31eee",
"sha384": "6f71dee19ba3fbdc5c15e857c98727eb91c318321c1c8d5a716a6b5d1b0404acb2a62fd975562545701013ec7f99329f",
"sha512": "731859029215873fdac1c9f2f8bd25a334abf0f3a9e1b057cf2cacc2826d86b0c26a3fa920a936421401c0471f38857cb53ba905489ea46b185209fdff65b3b6"
}
},
for policy=on_demand:
"images": [
{
"name": "upgrade",
"path": "images/pxeboot/upgrade.img",
"platforms": "x86_64, xen",
"artifact": null
},
pulp_rpm/app/tasks/synchronizing.py
Outdated
| for path, checksum in self.kickstart["download"]["images"].items(): | ||
| artifact = Artifact() | ||
|
|
||
| if checksum: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but can't this loop also be handled as L#279 being written as: artifact = Artifact(**checksum) and this loop could be dropped?
| ) | ||
| # TODO: decide how to distinguish between a mirror list and a normal repo | ||
| result = await downloader.run() | ||
| metadata_pb.increment() | ||
|
|
||
| if self.kickstart: | ||
| d_artifacts = [] | ||
| for path, checksum in self.kickstart["download"]["images"].items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this part also sync the part of this .treeinfo file that has:
[stage2]
mainimage = images/install.img
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it does sync this part:
https://github.com/fabricio-aguiar/pulp_rpm/blob/5202-kickstart-sync/pulp_rpm/app/tasks/utils.py#L170-L174
but it will only stay in distribution_tree._artifacts because I don't create an Image form them if it does not appear on the checksums section.
| RPM_KICKSTART_FIXTURE_SUMMARY | ||
| ) | ||
|
|
||
| # Sync the repository again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see additional value in this re-sync aspect of this test given that it's in other tests already.
What is important for on_demand correctness assertion is that the content that is available "on_demand" can actually be fetched by Pulp smash. Can you assert that additionally via get_content() calls and validating the checksums of the content you are recieving. This would simulate a client actually fetching it which is key.
|
One special case we need to handle (and don't yet AIUI) is where the treeinfo file has a Variant that references the "main repository" with something like In that case the main sync machinery is already handling it and so the Variant needs to only preserve the data such as: It should not create a new repository to hold that content because the main sync machinery is going to handle syncing it into the existing the repository that the user thinks of as "their repository" Does this make sense? |
it does not create a new repo: |
519e1e4
to
21bcc10
Compare
pulp_rpm/app/tasks/synchronizing.py
Outdated
| @@ -110,7 +143,7 @@ class RpmFirstStage(Stage): | |||
| that should exist in the new :class:`~pulpcore.plugin.models.RepositoryVersion`. | |||
| """ | |||
|
|
|||
| def __init__(self, remote, deferred_download): | |||
| def __init__(self, remote, deferred_download, new_url=None, kickstart={}): | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange bugs can come from a kwarg whose default is a mutable type because if the first time you call it you mutate it, the second time you call it it shows up mutated which is usually unexpected. Generally a None as the default is considered a better practice.
closes #5202 https://pulp.plan.io/issues/5202 Required PR: pulp#1418
21bcc10
to
0057cab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks all good to me. Thank you @fabricio-aguiar !
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427 Required PR: pulp#1440
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427 Required PR: pulp#1440
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427 Required PR: pulp#1440
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427 Required PR: pulp#1440
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427 Required PR: pulp#1440
closes #5206 https://pulp.plan.io/issues/5206 Required PR: pulp#1418 Required PR: pulp#1427 Required PR: pulp#1440
depends on: #1418
closes #5202
https://pulp.plan.io/issues/5202
Required PR: #1418