sodafoundation / delfin

delfin is the SODA Infrastructure Manager project which provides unified, intelligent and scalable resource management, alert and performance monitoring
https://sodafoundation.io/
Apache License 2.0
202 stars 355 forks source link

Return statement is present inside the finally block #873

Closed vineela1999 closed 2 years ago

vineela1999 commented 2 years ago

Issue/Feature Description: In delfin/drivers/utils/tools.py In the body of the function get_remote_file_to_xml the below code shouldnt have return statement in the finally block

finally:
            if os.path.exists(local_file):
                Tools.remove_file_with_same_type(file, local_path)
            return root_node

Why this issue to fixed / feature is needed(give scenarios or use cases): Because using return in a finally block suppresses the propagation of any unhandled exception which was raised in the try, else or except blocks. It will also ignore their return statements.

How to reproduce, in case of a bug:

Other Notes / Environment Information: (Please give the env information, log link or any useful information for this issue)