Skip to content

Commit

Permalink
Fix regression in installing removed packages during rollback
Browse files Browse the repository at this point in the history
We were passing a set object to iterate over to compose a message of
packages that got removed during yum transaction. This problem was not
happening before as we were dealing with a success case of restoring
packages. In this regression, we found out that a set object does not
have indexing, therefore, thus bug was hidden from most of our tests and
pipeline.
  • Loading branch information
r0x0d committed May 16, 2024
1 parent f784699 commit 5344d81
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion convert2rhel/pkgmanager/handlers/yum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _resolve_yum_problematic_dependencies(output):
packages_to_remove.append(str(resolve_error[0]).replace(" ", ""))

if packages_to_remove:
packages_to_remove = set(packages_to_remove)
packages_to_remove = list(set(packages_to_remove))
loggerinst.debug(
"Removing problematic packages to continue with the conversion:\n%s",
"\n".join(packages_to_remove),
Expand Down
34 changes: 19 additions & 15 deletions convert2rhel/unit_tests/pkgmanager/handlers/yum/yum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,17 @@ def test_run_transaction_critical_error_exception(self, _mock_yum_api_calls, pre
"python2-dnf-4.0.9.2-2.el7_9.noarch requires python2-hawkey >= 0.22.5",
"abrt-retrace-client-2.1.11-60.el7.centos.x86_64 requires abrt = 2.1.11-60.el7.centos",
],
frozenset(
(
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"python2-dnf-plugins-core-4.0.2.2-3.el7_6.noarch",
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"ldb-tools-1.5.4-2.el7.x86_64",
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"python2-dnf-4.0.9.2-2.el7_9.noarch",
"abrt-retrace-client-2.1.11-60.el7.centos.x86_64",
list(
set(
[
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"python2-dnf-plugins-core-4.0.2.2-3.el7_6.noarch",
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"ldb-tools-1.5.4-2.el7.x86_64",
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"python2-dnf-4.0.9.2-2.el7_9.noarch",
"abrt-retrace-client-2.1.11-60.el7.centos.x86_64",
]
)
),
),
Expand All @@ -414,18 +416,20 @@ def test_run_transaction_critical_error_exception(self, _mock_yum_api_calls, pre
"python2-dnf-plugins-core-4.0.2.2-3.el7_6.noarch requires python2-hawkey >= 0.7.0",
"abrt-retrace-client-2.1.11-60.el7.centos.x86_64 requires abrt = 2.1.11-60.el7.centos",
],
frozenset(
(
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"python2-dnf-plugins-core-4.0.2.2-3.el7_6.noarch",
"abrt-retrace-client-2.1.11-60.el7.centos.x86_64",
list(
set(
[
"redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64",
"python2-dnf-plugins-core-4.0.2.2-3.el7_6.noarch",
"abrt-retrace-client-2.1.11-60.el7.centos.x86_64",
]
)
),
),
# Random string - This might not happen that frequently.
(
["testing the test random string"],
frozenset(()),
[],
),
),
)
Expand Down

0 comments on commit 5344d81

Please sign in to comment.