Fix exception in normalize_schemas for conflicting actor config schemas - #925
Merged
Conversation
matejmatuska
force-pushed
the
fix-config-typerror
branch
from
May 20, 2026 11:16
661ab94 to
1d49624
Compare
MichalHe
reviewed
May 20, 2026
matejmatuska
force-pushed
the
fix-config-typerror
branch
from
May 20, 2026 11:16
1d49624 to
dd68ff6
Compare
matejmatuska
force-pushed
the
fix-config-typerror
branch
from
May 20, 2026 11:19
dd68ff6 to
662b8ed
Compare
pirat89
reviewed
May 20, 2026
matejmatuska
force-pushed
the
fix-config-typerror
branch
3 times, most recently
from
May 20, 2026 13:48
9c2b0bf to
ec33aae
Compare
The normalize_schemas function incorrectly raises an exception when a
config schema (subclass of Config) is contained more than once in it's
input, regardless of whether it's a conflicting (same section and name,
but a difference in other members) or the same (same section and name).
Traceback:
Traceback (most recent call last):
File "/usr/bin/leapp", line 33, in <module>
sys.exit(load_entry_point('leapp==0.21.0', 'console_scripts', 'leapp')())
File "/usr/lib/python3.9/site-packages/leapp/cli/__init__.py", line 51, in main
cli.command.execute('leapp version {}'.format(VERSION))
File "/usr/lib/python3.9/site-packages/leapp/utils/clicmd.py", line 111, in execute
args.func(args)
File "/usr/lib/python3.9/site-packages/leapp/utils/clicmd.py", line 133, in called
self.target(args)
File "/usr/lib/python3.9/site-packages/leapp/cli/commands/upgrade/breadcrumbs.py", line 169, in wrapper
return f(*args, breadcrumbs=breadcrumbs, **kwargs)
File "/usr/lib/python3.9/site-packages/leapp/cli/commands/preupgrade/__init__.py", line 86, in preupgrade
command_utils.load_actor_configs_and_store_it_in_db(context, repositories, cfg)
File "/usr/lib/python3.9/site-packages/leapp/cli/commands/command_utils.py", line 291, in load_actor_configs_and_store_it_in_db
actor_config_schemas = actor_config.normalize_schemas(actor_config_schemas)
File "/usr/lib/python3.9/site-packages/leapp/actors/config.py", line 180, in normalize_schemas
if unique_name in added_fields and added_fields[unique_name] != field:
TypeError: 'set' object is not subscriptable
The added_fields variable is a set. The condition for checking conflicts
attempts to do indexing on the set, which is not possible in Python sets
and results in a TypeError.
This patch removes the set altogether since it doesn't bring any
advantage over just using the normalized_schemas dict.
Also add unit tests for the function.
The test rules always lints, add a variant which just tests.
matejmatuska
force-pushed
the
fix-config-typerror
branch
from
May 21, 2026 10:11
ec33aae to
7b66ef6
Compare
pirat89
approved these changes
May 21, 2026
pirat89
left a comment
Member
There was a problem hiding this comment.
lgtm now. we discussed the problem and changes via call and all requested changes have been delivered.
Merged
pirat89
pushed a commit
that referenced
this pull request
Jul 29, 2026
## Packaging - Bump leapp-framework to 6.6 (#913, #919, #921, #929) ### Fixes - Change how commands are converted for text based report from the list representation (#919, #921) - Fix the crashing check of conflicts between actor config schemes (#925) ### Enhancements - Introduce the format_list function for unified presentation of lists in reports and logs (#913) ## stdlib ### Enhancements - Introduce the format_list function for unified presentation of lists in reports and logs (#913)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The normalize_schemas function incorrectly raises an exception when a config schema (subclass of Config) is contained more than once in it's input, regardless of whether it's a conflicting (same section and name, but a difference in other members) or the same (same section and name).
Traceback example:
The added_fields variable is a set. The condition for checking conflicts attempts to do indexing on the set, which is not possible in Python sets and results in a TypeError.
This patch removes the set altogether since it doesn't bring any advantage over just using the normalized_schemas dict.