Skip to content

Commit

Permalink
Fix getting installed groups for given environment
Browse files Browse the repository at this point in the history
The CompsEnvironmentGroup.getInstalled does not reflect which groups
are actually installed, but rather which were installed when the
environment was installed. This can cause the subsequent group
upgrade to fail.

This patch changes it so that only installed groups are upgraded.

= changelog =
related: https://bugzilla.redhat.com/show_bug.cgi?id=1872586

Closes: #1658
Approved by: j-mracek
  • Loading branch information
pkratoch authored and rh-atomic-bot committed Sep 10, 2020
1 parent d465477 commit 76f4cec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dnf/comps.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def _environment_upgrade(self, env_id):
if not comps_env:
raise CompsError(_("Environment '%s' is not available.") % env_id)

old_set = set([i.getGroupId() for i in swdb_env.getGroups() if i.getInstalled()])
old_set = set([i.getGroupId() for i in swdb_env.getGroups()])
pkg_types = swdb_env.getPackageTypes()

# create a new record for current transaction
Expand All @@ -649,8 +649,9 @@ def _environment_upgrade(self, env_id):
trans = TransactionBunch()
for comps_group in comps_env.mandatory_groups:
if comps_group.id in old_set:
# upgrade existing group
trans += self._group_upgrade(comps_group.id)
if self.history.group.get(comps_group.id):
# upgrade installed group
trans += self._group_upgrade(comps_group.id)
else:
# install new group
trans += self._group_install(comps_group.id, pkg_types)
Expand Down

0 comments on commit 76f4cec

Please sign in to comment.