From b26725f654f2c58a219367f5221da0c148a5cd55 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Sat, 3 Jan 2015 13:45:06 -0500 Subject: [PATCH] Move strptime workaround to fail2ban/__init__.py --- bin/fail2ban-client | 3 --- bin/fail2ban-regex | 3 --- bin/fail2ban-server | 3 --- fail2ban/__init__.py | 4 ++++ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/fail2ban-client b/bin/fail2ban-client index b91c339c..866a5287 100755 --- a/bin/fail2ban-client +++ b/bin/fail2ban-client @@ -430,9 +430,6 @@ class ServerExecutionException(Exception): pass if __name__ == "__main__": # pragma: no cover - can't test main - from time import strptime - # strptime thread safety hack-around - http://bugs.python.org/issue7980 - strptime("2012", "%Y") client = Fail2banClient() # Exit with correct return value if client.start(sys.argv): diff --git a/bin/fail2ban-regex b/bin/fail2ban-regex index 96aca926..5644dd37 100755 --- a/bin/fail2ban-regex +++ b/bin/fail2ban-regex @@ -474,9 +474,6 @@ class Fail2banRegex(object): if __name__ == "__main__": - from time import strptime - # strptime thread safety hack-around - http://bugs.python.org/issue7980 - strptime("2012", "%Y") parser = get_opt_parser() (opts, args) = parser.parse_args() diff --git a/bin/fail2ban-server b/bin/fail2ban-server index dc8d81b4..ec0c0dbe 100755 --- a/bin/fail2ban-server +++ b/bin/fail2ban-server @@ -131,9 +131,6 @@ class Fail2banServer: return False if __name__ == "__main__": - from time import strptime - # strptime thread safety hack-around - http://bugs.python.org/issue7980 - strptime("2012", "%Y") server = Fail2banServer() if server.start(sys.argv): sys.exit(0) diff --git a/fail2ban/__init__.py b/fail2ban/__init__.py index cbaaf757..b7906099 100644 --- a/fail2ban/__init__.py +++ b/fail2ban/__init__.py @@ -68,3 +68,7 @@ logging.notice = _root_notice # add NOTICE to the priority map of all the levels logging.handlers.SysLogHandler.priority_map['NOTICE'] = 'notice' + +from time import strptime +# strptime thread safety hack-around - http://bugs.python.org/issue7980 +strptime("2012", "%Y")