-
Notifications
You must be signed in to change notification settings - Fork 25
Support pulp sync repository operation #78
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
Support pulp sync repository operation #78
Conversation
f7539ad to
2b01e82
Compare
Repository.sync() operation is now supported for Yum,File and ContainerImage Repository
2b01e82 to
20ca414
Compare
rohanpm
left a comment
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.
Most of my comments are about the SyncOptions classes. I think that you've added an option for pretty much everything which exists in Pulp, but not all of them make sense.
I put specific comments on some of them, and in general could you please consider cutting those down a bit into only those where there's a reasonable expectation of actually using them in our toolchain?
| return f_map(response, error_fn=map_404_to_none) | ||
|
|
||
| def _do_sync(self, repo_id, sync_options): | ||
| if not sync_options["feed"]: |
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.
Should we have this check actually?
- Like any other options, it's possible for feed to be stored on the importer config itself, in which case it's not necessary to pass it. Ideally the library doesn't block this scenario.
- If the Pulp server really needs a feed (because it's missing from importer config), it should already be returning a meaningful error message, so we shouldn't have to duplicate the same error check 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.
Well, I wanted to do this "user-friendly" and fails asap if there's obvious error. As you said feed can be used from importer but to do that I would have to implement the model and another support code, which is something I'm not that much willing to do now due lots of changes needed in another projects right now. So I thought we still override feed everytime so let's check that feed is not empty here and in the future we can implement importer model in repository model.
If workflow is: get repository model, run sync, then at that time you will have already information about importer configuration and you can decide if there's feed or not and therefore if "external" feed is required.
Another reason is log message few lines bellow this one which tells you: Syncing repository with feed: xxx.
But maybe it's unnecessary complicated and I should rather let pulp return error 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 didn't mean that this library needs to fetch the importer and use it to initialize feed - I meant that you can just do a sync request to Pulp without including any feed, and it'll work if the importer already has a feed or it'll return a meaningful error if it doesn't. So you wouldn't have to add Importer models yet.
In any case though, I don't consider this a blocker for the merge request, seeing as it can be easily changed later without breaking compatibility.
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
- Fixed documentation for SyncOptions attributes - Fixed wrong attribute types - Renamed test_sync to test_sync_no_feed - Fixed doc strings for tests
I agree we don't use them in our toolchain - yet. This is I think third time I decided to use pubtools-pulplib for implementation of some new feature in our toolchain and I found out that there's missing functionality I need in this library. So I thought it would be better to rather implement everything that is supported then in the future find out you need to add something again. |
- Make ContainerSyncOptions, FileSyncOptions, YumSyncOptions public
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Co-Authored-By: Rohan McGovern <rohan@mcgovern.id.au>
Repository.sync() operation is now supported for Yum,File and
ContainerImage Repository