8000 fix/reposync_librepo by tpw56j · Pull Request #2942 · cobbler/cobbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix/reposync_librepo #2942

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

Merged
merged 5 commits into from
Mar 11, 2022
Merged

fix/reposync_librepo #2942

merged 5 commits into from
Mar 11, 2022

Conversation

tpw56j
Copy link
Contributor
@tpw56j tpw56j commented Feb 16, 2022

I suggest to always delete old metadata in .origin/repodata. When you try to partially update metadata, many problems arise. For example, #2865 and librepo trying to download the metadata that remained in the local repomd.xml, but have already been deleted in the remote repo:

Exception occurred: <class 'cobbler.cexceptions.CX'>
Exception value: 'librepo error: /var/www/cobbler/repo_mirror/rpmfusion-free-updates-35/.origin - Yum repo downloading error: Downloading error(s): repodata/9274ff7709a56d3c635f906cc96
8000
d0def2c57b1e3b02511abc38a2670a2e2888d-filelists.xml.gz - Cannot download, all mirrors were already tried without success; repodata/00a10fddedf1a92749f9f821886812b283be7633b77dae288128ad7248ec3b88-primary.xml.gz - Cannot download, all mirrors were already tried without success; repodata/0e054452f9e3a02b5329e9eedc3369716527bd9881f311e62c1dd091506bf3ba-primary.sqlite.xz - Cannot download, all mirrors were already tried without success; repodata/e0f5933741cce793f385bb3a63aa0ec854ecbfee0931a1b8772e9031d4de27bb-other.sqlite.xz - Cannot download, all mirrors were already tried without success; repodata/7d698af9dd0f71ea760d5775057484f4873754ef5431a3146bca900da6eba277-other.xml.gz - Cannot download, all mirrors were already tried without success; repodata/08d87ac56781082a6317b75d091acfd54e24db8d5dd980fcbbf93c375ae61860-filelists.sqlite.xz - Cannot download, all mirrors were already tried without success'
Exception Info:
reposync failed, tries left: 0
Exception occurred: <class 'cobbler.cexceptions.CX'>
Exception value: 'reposync failed, retry limit reached, aborting'
Exception Info:
Exception occurred: <class 'cobbler.cexceptions.CX'>
Exception value: 'reposync failed, retry limit reached, aborting'
Exception Info:
!!! TASK FAILED !!!

Fixes #2865

@codecov
Copy link
codecov bot commented Feb 16, 2022

Codecov Report

Merging #2942 (b9cb719) into master (d139057) will increase coverage by 1.39%.
The diff coverage is 47.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2942      +/-   ##
==========================================
+ Coverage   60.49%   61.88%   +1.39%     
==========================================
  Files         101      101              
  Lines       14415    14407       -8     
==========================================
+ Hits         8720     8916     +196     
+ Misses       5695     5491     -204     
Impacted Files Coverage Δ
cobbler/cli.py 65.13% <ø> (ø)
cobbler/actions/reposync.py 58.78% <47.91%> (+47.51%) ⬆️
cobbler/settings/migrations/V3_0_1.py 80.00% <0.00%> (-13.34%) ⬇️
cobbler/settings/migrations/V3_1_1.py 80.00% <0.00%> (-13.34%) ⬇️
cobbler/settings/migrations/V3_2_0.py 84.21% <0.00%> (-10.53%) ⬇️
cobbler/settings/migrations/V3_3_1.py 84.21% <0.00%> (-10.53%) ⬇️
cobbler/settings/migrations/V3_3_0.py 90.32% <0.00%> (-6.46%) ⬇️
cobbler/utils.py 74.87% <0.00%> (+0.10%) ⬆️
cobbler/api.py 60.90% <0.00%> (+0.34%) ⬆️
cobbler/cobbler_collections/repos.py 88.88% <0.00%> (+2.77%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d139057...b9cb719. Read the comment docs.

@SchoolGuy SchoolGuy added this to the v3.3.2 milestone Feb 21, 2022
@SchoolGuy SchoolGuy self-requested a review February 21, 2022 13:48
@SchoolGuy
Copy link
Member

@tpw56j Would you mind rebasing this onto master as I have merged some CI related fixes?

@tpw56j
Copy link
Contributor Author
tpw56j commented Feb 21, 2022

Ok, I'll do a rebase.
Now I've found more problems with reposync and I wanted to make some additional changes and it seems like a rebase is better to do when I'm done with these changes:

  • make it possible to set an empty value for Repo.Arch and make it the default value. Otherwise, for example, if you set arch to x86_64, dnf reposync will not synchronize the noarch packages, which are also usually included in the repo.
  • write tests for reposync

@SchoolGuy
Copy link
Member

@tpw56j Both changes are fine by me. Feel free to take the time. I want to have this for 3.3.2 because it will be a bugfix release and this seems like a good candidate for such bugfixing!

@tpw56j tpw56j force-pushed the fix/reposync_librepo branch from c70d074 to a989e56 Compare February 23, 2022 17:29
@tpw56j
Copy link
Contributor Author
tpw56j commented Feb 24, 2022

@SchoolGuy Could you please re-run the tests, I don't understand why the reposync tests failed.

@SchoolGuy
Copy link
Member

@tpw56j Sure. I guess it would be the best long term that we mock the actual execution of reposync to not make the test lengthy on bad internet connectivity.

@SchoolGuy
Copy link
Member
SchoolGuy commented Feb 28, 2022

@tpw56j Any update on this PR?

Edit: Retriggering the tests didn't help.

@tpw56j
Copy link
Contributor Author
tpw56j commented Feb 28, 2022

@SchoolGuy I still can't figure out why the test fails. On my computer it works.

@SchoolGuy
Copy link
Member

@tpw56j If I click on the URLs you choose I indeed get a 404 from nginx on some of them. Could it be the mirror "magically" choosen by Fedora for us?

@SchoolGuy
Copy link
Member

@tpw56j I will take a look at the tests for you. I trust that you have tested this will in your environment and that it works. It will go into the next release!

@SchoolGuy SchoolGuy self-assigned this Mar 5, 2022
@SchoolGuy SchoolGuy added feature/PKG Issues related to the package management tests labels Mar 5, 2022
@tpw56j
Copy link
Contributor Author
tpw56j commented Mar 5, 2022

@SchoolGuy It seems to me that the python3-librepo package is missing in the development container. I'll check now.

@SchoolGuy
Copy link
Member

@tpw56j Wait that is indeed possible because I didn't update the dockerfile in the OBS. But why is the error message so cryptic in this case?

@tpw56j
Copy link
Contributor Author
tpw56j commented Mar 5, 2022

@SchoolGuy The message that reposync returns to stderr is lost in pytest. The python3-librepo package is really missing, but it looks like something else is missing.

@SchoolGuy
Copy link
Member

@tpw56j Can we improve that before we add the package in OBS? Because that is really misleading for everyone?

@tpw56j
Copy link
Contributor Author
tpw56j commented Mar 5, 2022

@SchoolGuy The error that reposync returns when the package is missing is no less mysterious:

received on stderr: Error: Failed to download metadata for repo 'test0': Cannot download repomd.xml: Empty mirrorlist and no basepath specified!

@SchoolGuy
Copy link
Member

@tpw56j Since we are missing a python package, can't we add a helper function in the style?

def helper() -> helper:
    try:
         import package
         return True
    except:
         return False

@SchoolGuy
Copy link
Member

@tpw56j Could you please not use the die() function. I want to get rid of the global exception handler. Just raise a module not found exception with the same message. It has the same effect and due to the switch to Python logging, the output should be very similar in the log.

@SchoolGuy
Copy link
Member

@tpw56j Now we have a single failing test instead of multiple. This is great progress! Any ideas about this specific test?

@tpw56j
Copy link
Contributor Author
tpw56j commented Mar 6, 2022

@SchoolGuy I haven't found a satisfactory solution to sync apt repos. Installing debmirror from the Fedora repo in OBS is not a complete solution to this problem. After making changes to OBS, docker/develop/scripts/setup-reposync.sh the script will need to be removed.

@SchoolGuy
Copy link
Member

@tpw56j Thanks a lot for this PR! I will review this at work tomorrow.

@SchoolGuy
Copy link
Member

@tpw56j Updating the Dockerfile is not easy as builds in the OBS are offline. Which means I need to package debmirror.

However there is light because this was already done for openSUSE before here.

Copy link
Member
@SchoolGuy SchoolGuy left a comment

Choose a reason for hiding this comment

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

This is a great start but I believe due to my refactoring we need at least one change sadly.

@tpw56j tpw56j force-pushed the fix/reposync_librepo branch from cc648f4 to 3e67449 Compare March 7, 2022 17:05
@SchoolGuy
Copy link
Member

@tpw56j Today I will release a new version. Thus I will rebase this PR myself and clean the Git history. Thanks for your big contribution again! The failing test I will skip for now and fix at a later point. The code itself should work and that is the important thing. I believe the failures are more related to the package infrastructure then your test.

Copy link
Member
@SchoolGuy SchoolGuy left a comment

Choose a reason for hiding this comment

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

LGTM

SchoolGuy and others added 4 commits March 11, 2022 09:32
Co-authored-by: tpw56j <smoker.tabac@gmail.com>
Co-authored-by: tpw56j <smoker.tabac@gmail.com>
Co-authored-by: tpw56j <smoker.tabac@gmail.com>
This commit is cleaning up the reposync code greatly.

  - os.path.join() now is used as intended
  - repo.name is not chained to a strip() anymore as spaces in names are anyway
    not allowed
  - Unnecessary parentheses were removed
  - As commit title says: utils.die was replaces with the custom Cobbler
    exception CX

Repo metadata is always deleted now because merging the metadata is prone to
errors.

Co-authored-by: tpw56j <smoker.tabac@gmail.com>
@SchoolGuy SchoolGuy force-pushed the fix/reposync_librepo branch from 23e06a2 to 510fe90 Compare March 11, 2022 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/PKG Issues related to the package management tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cobbler reposync fails with error /var/www/cobbler/repo_mirror/<reponame>/.origin/repodata: File exists: 'Cannot create output directory'
2 participants
0