Foreman 2.4 / Katello 4.0: Issue sync'ing repos for CentOS Stream

You have to apply the patch above, i.e. edit /usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py and then restart foreman.

1 Like

This is what I did:

wget https://raw.githubusercontent.com/pulp/pulp_rpm/f14be05d58f06e794676a5222b443cd9d082f031/pulp_rpm/app/tasks/synchronizing.py /tmp
copy /tmp/synchronizing.py /usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py
restart foreman server

still get the following error when sync:
'utf-8' codec can't decode byte 0xfd in position 0: invalid start byte

Am I doing something wrong?

That file does not contain the patch above. I don‘t know which version it is. Restore the original file and then edit it. I don‘t think the patched version is available as download anywhere…

Is this what I need to modify ?

--- /usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py.old    2021-03-25 13:24:01.000000000 -0400

+++ /usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py.new 2021-05-05 16:13:50.016460535 -0400
@@ -1,5 +1,6 @@
import asyncio
import gzip
+import lzma
import logging
import os
import re
@@ -742,7 +743,12 @@ class ModulesMetadataParser:
“”“Parse module.yaml, if exists, to create relations between packages.”""
if self.modulemd_result:
modulemd_index = mmdlib.ModuleIndex.new()

  •        open_func = gzip.open if self.modulemd_result.url.endswith(".gz") else open
    
  •        if self.modulemd_result.url.endswith(".gz"):
    
  •            open_func = gzip.open
    
  •        elif self.modulemd_result.url.endswith(".xz"):
    
  •            open_func = lzma.open
    
  •        else:
    
  •            open_func = open
           with open_func(self.modulemd_result.path, "r") as moduleyaml:
               content = moduleyaml.read()
               module_content = content if isinstance(content, str) else content.decode()

That is the file. Your formatting is messed up. It’s hard to tell if it’s right. Look at the post with the diff/patch above. If it’s right it should exactly like that. Note, that in the diff above the patched version was given first and the original second.

If it looks like that it is correct, assuming you have really restored the original file from the rpm (before your wget).

no luck
It broke the other repository sync as well after this update.
I had a backup locally before I made a change. so, I applied the changes as described in the above “diff” post.
code_Capture1

code_Capture

@salton did you restart all of your Pulpcore services after applying the patch?

sudo systemctl restart pulpcore* --all

Yes, I did.

Do you see the error from Pulp in /var/log/messages or the Dynflow console? The full Python backtrace should hopefully show us why the patch isn’t working.

Thanks @iballou it works now :slight_smile:

I just tried it again but this time I just type instead of copy/paste the code.

1 Like

@katello when is this patch likely to be released for GA?

If you want to quote code, put three backticks ``` in a seperate line before and after the code.

When editing python, indentation is of the essence.

For the future, you can find the RPM which contains a file (if it came out of an RPM):

# rpm -qf /usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py
python3-pulp-rpm-3.10.0-1.el7.noarch

And also check if it the original:

# rpm -V python3-pulp-rpm-3.10.0-1.el7.noarch
..5....T.    /usr/lib/python3.6/site-packages/pulp_rpm/app/kickstart/treeinfo.py
S.5....T.    /usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py

You can easily restore the original if you need to

# yum reinstall python3-pulp-rpm-3.10.0-1.el7.noarch
2 Likes

Hey all,

Katello 4.1.0 was just released, which has the official fix for this issue.

2 Likes

Just wanted to confirm that I upgraded to Katello 4.1 today and it did indeed fix my syncing issue. Thanks!

2 Likes

@mark.frank, what repo did you use for katello 4.1? I have the same issue

The repos that weren’t syncing for me prior to the Katello 4.1 upgrade were the CentOS 8 repos, specifically Base and AppStream.