Actions
Bug #17080
closedBug #16521: Rudder agent 5.x package not compatible with Centos8
Bug #16751: NCF python script should not be forced to python2
Python 2 vs 3 error on centos8 for package install
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Reviewed
Fix check:
Error - Fixed
Regression:
Description
On rudder 5.0, when using a package present gm, even with parent ticket corrected, I got:
Traceback (most recent call last): File "/var/rudder/cfengine-community/modules/packages/yum", line 430, in <module> sys.exit(main()) File "/var/rudder/cfengine-community/modules/packages/yum", line 412, in main return list_updates(True) File "/var/rudder/cfengine-community/modules/packages/yum", line 139, in list_updates line = lastline + line TypeError: must be str, not bytes Traceback (most recent call last): File "/var/rudder/cfengine-community/modules/packages/yum", line 430, in <module> sys.exit(main()) File "/var/rudder/cfengine-community/modules/packages/yum", line 415, in main return list_updates(False) File "/var/rudder/cfengine-community/modules/packages/yum", line 139, in list_updates line = lastline + line TypeError: must be str, not bytes error: Error installing package 'acpid' error: Method 'ncf_package' failed in some repairs error: Method 'package_present' failed in some repairs error: Method 'test_plop' failed in some repairs
Updated by François ARMAND over 4 years ago
So, it happens that the problem is not in the choice of python 3, that is correctly done, but in the `yum` script itself. We don't have that problem in 6.0, so there is a diff:
diff -u yum-5.0 yum-6.0 --- yum-5.0 2020-04-08 16:08:36.846656642 +0200 +++ yum-6.0 2020-04-08 16:07:36.199261512 +0200 @@ -114,33 +114,44 @@ def list_updates(online): + global yum_options for line in sys.stdin: line = line.strip() if line.startswith("options="): option = line[len("options="):] - if option.startswith("enablerepo=") or option.startswith("disablerepo="): - global yum_options - yum_options += ["--" + option] + if option.startswith("-"): + yum_options.append(option) + elif option.startswith("enablerepo=") or option.startswith("disablerepo="): + yum_options.append("--" + option) online_flag = [] if not online: online_flag = ["-C"] process = subprocess_Popen([yum_cmd] + yum_options + online_flag + ["check-update"], stdout=subprocess.PIPE) + (stdoutdata, _) = process.communicate() + # analyze return code from `yum check-update`: + # 0 means no updates + # 1 means there was an error + # 100 means that there are available updates + if process.returncode != 100: + # either there were no updates or error happened + # Nothing to do for us here anyway + return process.returncode lastline = "" - for line in process.stdout: + for line in stdoutdata.splitlines(): # Combine multiline entries into one line. A line without at least three # space separated fields gets combined with the next line, if that line # starts with a space. - if lastline and not line[0].isspace(): + if lastline and (len(line) == 0 or not line[0].isspace()): # Line does not start with a space. No combination. lastline = "" line = lastline + line match = re.match("^\S+\s+\S+\s+\S+", line) if match is None: - # Keep line but strip trailing newline. - lastline = line[:-1] + # Keep line + lastline = line continue lastline = "" @@ -217,9 +228,10 @@ line = line.strip() if line.startswith("options="): option = line[len("options="):] - if option.startswith("enablerepo=") or option.startswith("disablerepo="): - global yum_options - yum_options += ["--" + option] + if option.startswith("-"): + yum_options.append(option) + elif option.startswith("enablerepo=") or option.startswith("disablerepo="): + yum_options.append("--" + option) if line.startswith("Name="): if name: # Each new "Name=" triggers a new entry.
Updated by Benoît PECCATTE over 4 years ago
- Status changed from New to In progress
- Assignee set to Benoît PECCATTE
Updated by Benoît PECCATTE over 4 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from Benoît PECCATTE to Félix DALLIDET
- Pull Request set to https://github.com/Normation/ncf/pull/1168
Updated by Benoît PECCATTE over 4 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset commit:b45d9a7356c31c6ae84b45cfaa7713ce7b825eb4.
Updated by Alexis Mousset over 4 years ago
- Fix check changed from To do to Error - Blocking
Updated by François ARMAND over 4 years ago
- Fix check changed from Error - Blocking to Error - Fixed
Updated by Alexis Mousset over 4 years ago
- Name check changed from To do to Reviewed
Updated by Vincent MEMBRÉ over 4 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 5.0.17 and 6.0.5 which were released today.
Actions