8000 resourceManager: use f-strings in exceptions by aesteve-rh · Pull Request #358 · oVirt/vdsm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

resourceManager: use f-strings in exceptions #358

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

Merged

Conversation

aesteve-rh
Copy link
Member
@aesteve-rh aesteve-rh commented Dec 7, 2022

Fix various exceptions in the resourceManager module, so that
it is constructed wiht f-string instead of %-format.
Fix ResourceAlreadyAcquired exception that is
using a comma to separate instead of %, resulting in
bogus printed message.

Before:

vdsm.storage.resourceManager.ResourceAlreadyAcquired: ('%s is already
acquired by %s', '00_storage.a2ad7a23-96c5-4c23-9007-c0d1892ea07d',
'fb7c6873-74b4-4895-876a-a52ab7bfa082')

After:

vdsm.storage.resourceManager.ResourceAlreadyAcquired:
'00_storage.a2ad7a23-96c5-4c23-9007-c0d1892ea07d is already
acquired by fb7c6873-74b4-4895-876a-a52ab7bfa082'

Signed-off-by: Albert Esteve aesteve@redhat.com

@aesteve-rh aesteve-rh requested review from nirs and mz-pdm December 7, 2022 10:02
@aesteve-rh aesteve-rh self-assigned this Dec 7, 2022
Copy link
Member
@nirs nirs left a comment

Choose a reason for hiding this comment

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

Only the first commit is fixing bad code that logged badly formatted error message. The rest of the commits are good but have bogus commit message.

@aesteve-rh aesteve-rh force-pushed the aesteve/fix-resource-acquired-exception branch from 2c2776f to 5a2e282 Compare December 7, 2022 12:13
@aesteve-rh aesteve-rh requested a review from nirs December 7, 2022 12:14
nirs
nirs previously approved these changes Dec 7, 2022
Copy link
Member
@nirs nirs left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@mz-pdm
Copy link
Member
mz-pdm commented Dec 7, 2022

/ost

1 similar comment
@aesteve-rh
Copy link
Member Author

/ost

Fix ResourceAlreadyAcquired raise to use f-string
instead of %-format. Also, the %-format is misued,
with a comma in between where the '%' symbol should
be, causing a bogus output.

Before:
vdsm.storage.resourceManager.ResourceAlreadyAcquired: ('%s is already
acquired by %s', '00_storage.a2ad7a23-96c5-4c23-9007-c0d1892ea07d',
'fb7c6873-74b4-4895-876a-a52ab7bfa082')

After:
vdsm.storage.resourceManager.ResourceAlreadyAcquired:
'00_storage.a2ad7a23-96c5-4c23-9007-c0d1892ea07d is already
acquired by fb7c6873-74b4-4895-876a-a52ab7bfa082'

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix ResourceDoesNotExist to be constructed
with an f-string instead of %-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix NamespaceRegistered so that it is
constructed with an fstring instead of
%-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix InvalidNamespace to be constructed
with an fstring instead of %-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix ValueError in resourceManager so that
it is constructed with f-string instead of
%-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix KeyError in resourceManager module so
that it is constructed with f-string instead
of using %-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix InvalidLockType so that it is constructed
with f-string instead of %-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
Fix RequestTimedOutError so that it is constructed
with fstring instead of %-format.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
@aesteve-rh aesteve-rh force-pushed the aesteve/fix-resource-acquired-exception branch from 5a2e282 to 161ae32 Compare December 12, 2022 08:05
@aesteve-rh
Copy link
Member Author

/ost

@aesteve-rh aesteve-rh requested a review from nirs December 12, 2022 09:25
@aesteve-rh aesteve-rh merged commit d1e3f0c into oVirt:master Dec 12, 2022
@aesteve-rh aesteve-rh deleted the aesteve/fix-resource-acquired-exception branch December 12, 2022 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0