FL-1862 add return codes to ob.py (#717)

This commit is contained in:
Lesha Lomalkin 2021-09-22 23:00:05 +03:00 committed by GitHub
parent 4c05f67686
commit b3becb9d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,10 +70,12 @@ class Main:
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
self.logger.error(e.output.decode()) self.logger.error(e.output.decode())
self.logger.error(f"Failed to call STM32_Programmer_CLI") self.logger.error(f"Failed to call STM32_Programmer_CLI")
exit(127)
return return
except Exception as e: except Exception as e:
self.logger.error(f"Failed to call STM32_Programmer_CLI") self.logger.error(f"Failed to call STM32_Programmer_CLI")
self.logger.exception(e) self.logger.exception(e)
exit(126)
return return
ob_correct = True ob_correct = True
for line in output.decode().split("\n"): for line in output.decode().split("\n"):
@ -98,6 +100,7 @@ class Main:
ob_correct = False ob_correct = False
if ob_correct: if ob_correct:
self.logger.info(f"OB Check OK") self.logger.info(f"OB Check OK")
exit(0)
else: else:
self.logger.error(f"OB Check FAIL") self.logger.error(f"OB Check FAIL")
exit(255) exit(255)
@ -124,12 +127,15 @@ class Main:
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
self.logger.error(e.output.decode()) self.logger.error(e.output.decode())
self.logger.error(f"Failed to call STM32_Programmer_CLI") self.logger.error(f"Failed to call STM32_Programmer_CLI")
exit(125)
return return
except Exception as e: except Exception as e:
self.logger.error(f"Failed to call STM32_Programmer_CLI") self.logger.error(f"Failed to call STM32_Programmer_CLI")
self.logger.exception(e) self.logger.exception(e)
exit(124)
return return
if __name__ == "__main__": if __name__ == "__main__":
Main()() Main()()
exit(0)