From 8cbbb5359155446be22a5efb1e2372e527d2d745 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Nov 11 2016 11:13:56 +0000 Subject: client: fix script execution if __name__ == "__main__" should be first instead of try block. We want execute it only when file was executed as script https://fedorahosted.org/freeipa/ticket/6392 Reviewed-By: Stanislav Laznicka --- diff --git a/client/ipa-client-install b/client/ipa-client-install index 0dfb2f6..ecb3a14 100755 --- a/client/ipa-client-install +++ b/client/ipa-client-install @@ -257,15 +257,16 @@ def main(): return rval -try: - if __name__ == "__main__": - sys.exit(main()) -except KeyboardInterrupt: - sys.exit(1) -except RuntimeError as e: - sys.exit(e) -finally: + +if __name__ == "__main__": try: - os.remove(client.CCACHE_FILE) - except Exception: - pass + sys.exit(main()) + except KeyboardInterrupt: + sys.exit(1) + except RuntimeError as e: + sys.exit(e) + finally: + try: + os.remove(client.CCACHE_FILE) + except Exception: + pass