From c7d12cddecf750ae9c92c1c857a9f3ce2905e7dc Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Thu, 19 Aug 2021 06:51:24 -0700 Subject: [PATCH] Ensure python main function return values (#7860) The main functions are wrapped by a sys.exit function which expects and argument. The curent implementation isn't returning values in all cases. This change ensures main functions return a value in all cases. --- contrib/inventory_builder/inventory.py | 1 + scripts/download_hash.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/inventory_builder/inventory.py b/contrib/inventory_builder/inventory.py index 184989fc3..042de28e6 100644 --- a/contrib/inventory_builder/inventory.py +++ b/contrib/inventory_builder/inventory.py @@ -430,6 +430,7 @@ def main(argv=None): if not argv: argv = sys.argv[1:] KubesprayInventory(argv, CONFIG_FILE) + return 0 if __name__ == "__main__": diff --git a/scripts/download_hash.py b/scripts/download_hash.py index e405d719d..30f276b75 100644 --- a/scripts/download_hash.py +++ b/scripts/download_hash.py @@ -56,8 +56,9 @@ def main(argv=None): argv = sys.argv[1:] if not argv: usage() - sys.exit(1) + return 1 download_hash(argv) + return 0 if __name__ == "__main__":