Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid AttributeError for DiskLabel formats without disklabel type #949

Conversation

vojtechtrefny
Copy link
Member

Simple instance of DiskLabel without label_type specified in the
constructor results in a AttributeError when trying to print the
format name. This makes sure the name is always valid.

Resolves: rhbz#1945914


Anaconda hits this when it's gathering format types for some DBus shenanigans. Simple reproducer is to get disklabel without specifying type blivet.formats.get_format("disklabel") and it will fail when printing the disklabel info (because __repr__ prints name). Alternatively we could make sure the _default_label_type is never None but that might break more things. It might be also better to have a special name for this "disklabel without type" but I wasn't able to come up with something that makes sense, so feel free to suggest something better.

Simple instance of DiskLabel without label_type specified in the
constructor results in a AttributeError when trying to print the
format name. This makes sure the name is always valid.

Resolves: rhbz#1945914
@vojtechtrefny
Copy link
Member Author

I reworked this a bit. We have another bug, this time on s390 where we try to check whether the device is FBA DASD and the check fails if device is None.

Copy link
Contributor

@japokorn japokorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@vojtechtrefny vojtechtrefny merged commit 98e4360 into storaged-project:3.4-devel Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants