Skip to content
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

Sync from a mirror list feed if provided #1690

Merged
merged 1 commit into from Jun 22, 2020

Conversation

lubosmj
Copy link
Member

@lubosmj lubosmj commented Apr 29, 2020

ref #6225

@pep8speaks
Copy link

pep8speaks commented Apr 29, 2020

Hello @lubosmj! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-06-19 22:25:18 UTC

@pulpbot
Copy link
Member

pulpbot commented Apr 29, 2020

Attached issue: https://pulp.plan.io/issues/6225

@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch 12 times, most recently from 99143c0 to 3b76bb7 Compare May 1, 2020 22:30
@lubosmj lubosmj marked this pull request as ready for review May 1, 2020 22:31
@lubosmj lubosmj requested a review from a team May 1, 2020 22:31
@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch from 3b76bb7 to 7706609 Compare May 3, 2020 10:03
@goosemania
Copy link
Member

@lubosmj , please, re-push (git commit --amend, git push -f ...), so the required check for your PR passes. We moved to travis-ci.com and your PR hasn't been tested there yet. Thanks.

@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch from 7706609 to ea53264 Compare May 7, 2020 17:35
@lubosmj lubosmj marked this pull request as draft May 22, 2020 13:57
@lubosmj
Copy link
Member Author

lubosmj commented May 22, 2020

I converted this to a draft PR because it is not possible to call docker exec anymore in order to replace the invalid fixtures.

@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch 9 times, most recently from ead64bd to 7405a0e Compare May 22, 2020 20:09
await self.put(dc)

missing_type = set(PACKAGE_REPODATA) - main_types
if missing_type:
Copy link
Member

@ipanova ipanova May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i understand correctly how mirrolist works is - is looks for the first available mirror and tries it. If there is some issue with the repodata it just fails. So once the download starts from a url there is not way back.
There are some BZ opened around this behaviour and we agreed that amatej will inform us once they fix this( complicated change)
https://bugzilla.redhat.com/show_bug.cgi?id=1819188
https://bugzilla.redhat.com/show_bug.cgi?id=1819188
I think we should follow same logic as currently mirrorlist has implemented. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the initial feature I think we should do the very simplest thing possible. I believe that would be:

  1. Use the repodata from the very first available mirror that will serve it, and try to fetch all content from that mirror exclusively. If anything goes wrong in fetching content fail (just like Pulp normally would in cases where there is no mirrorlist).
  2. Do not try to sort mirrors based on how fast or close they are
  3. Do not try to fetch content from multiple mirrors

We can improve (2) and (3) later, but having even basic mirrorlist support is still a useful feature for users because we currently do not support it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After rpm meeting we decided that for now we would want to follow the current implementation of mirrorlist( aka fail if the the first fetched url fails during download)
In the future we could add this kind of enhancement where other urls would be tried if previous fail, but for that we'd rather implement a mirrorlist downloader to be more flexibile

@ipanova
Copy link
Member

ipanova commented May 28, 2020

@lubosmj i don't think you handled case for treeinfo. It will always be ignored https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/kickstart/treeinfo.py#L21

@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch 6 times, most recently from ff62f86 to 12826df Compare May 29, 2020 11:18
@lubosmj lubosmj requested a review from ipanova May 29, 2020 11:43
@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch 2 times, most recently from caab6cd to d10c210 Compare May 29, 2020 11:57
with open(result.path) as mirror_list_file:
for mirror in mirror_list_file:
match = re.match(url_pattern, mirror)
if match and repodata_exists(remote, match.group(2)):
Copy link
Member

@ipanova ipanova Jun 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we should check whether the repodata for the url exists, i think we should just parse the file and add the urls to the list of feeds

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmbouter i don't have a strong opinion on this approach, thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we would do no parsing and try to use the URL blind. If the resultant works it works, if it fails try the next one.

Copy link
Member

@ipanova ipanova Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there have been some discussion around what should be the behaviour and this is what we agreed on: 1) identify whether this is a mirrorlist 2) find url that matches the regexp and check whether it has repomd.xml, once such url has been found return it and use it in the the sync, no need to parse other urls 3) if further issues will appear during the sync with that url just fail the sync

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for mirror in mirror_list_file:
    match = re.match(url_pattern, mirror)
    if match and repodata_exists(remote, match.group(2)):
        mirror_list_feed.append(match.group(2))
        break

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also get rid of the list and return the url instead

REPLACE_ORIGIN="sed -i -E 's/https?:\/\/.+?:[0-9]+\/fixtures\//${FIXTURE_ORIGIN}/g' /usr/share/nginx/html/fixtures/rpm-mirrorlist-bad"
docker exec -ti ${FIXTURES_CONTAINER_ID} sh -c "${REPLACE_ORIGIN}"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple PRs that should set the base url in mirror lists:

pulp/pulp-fixtures#164
pulp/plugin_template#233

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should enable it: #1750

@lubosmj lubosmj marked this pull request as draft June 19, 2020 20:17
@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch 5 times, most recently from ffd583b to 3795a23 Compare June 19, 2020 21:56
@lubosmj lubosmj force-pushed the mirror-list-feed-sync-6225 branch from 3795a23 to cafc129 Compare June 19, 2020 22:25
@lubosmj lubosmj marked this pull request as ready for review June 19, 2020 22:44
Copy link
Member

@ipanova ipanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all your work 🍰

@ipanova ipanova merged commit 43b3301 into pulp:master Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants