DMTF / Redfish-Service-Validator

The Redfish Service Validator is a Python3 tool for checking conformance of any "device" with a Redfish service interface against Redfish CSDL schema
Other
38 stars 33 forks source link

Fix bug in schema pack download #509

Closed edtanous closed 1 year ago

edtanous commented 1 year ago

Because of the conditional imports, when doing the name change from common to redfish_service_validator, one import got missed. This causes a bug where, if the schema pack directory is empty, redfish service validator fails with an ImportError.

This commit fixes the import.

Tested: Deleting the SchemaPack and running the service validator no longer fails.

Signed-off-by: Ed Tanous edtanous@google.com

edtanous commented 1 year ago

@mraineri Do you know why we conditionally import things? That seems like it would cause us to have a lot of these types of bugs over time. Could we just import everything at the top of each file? That seems like a more common pattern I see for python stuff.

tomasg2012 commented 1 year ago

In the spirit of optimization, I believe it saves a marginal amount of memory.

As a design practice I agree it's not necessary at all for a python tool, and is worth grouping it up top for consistency.

mraineri commented 1 year ago

Generally I've preferred things all imported at the top. If you see other areas where that's not the case, let's fix them.

mraineri commented 1 year ago

Merging now since this is a crash issue.