From 458c7c8131cb2b846fd0850ca17b4672076cfce6 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Wed, 4 Jan 2017 12:57:54 -0800 Subject: [PATCH] Use a set for pre_hook.already --- certbot/hooks.py | 4 ++-- certbot/tests/hook_test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/certbot/hooks.py b/certbot/hooks.py index ae190a930..a8099c4a8 100644 --- a/certbot/hooks.py +++ b/certbot/hooks.py @@ -54,11 +54,11 @@ def pre_hook(config): if cmd and cmd not in pre_hook.already: logger.info("Running pre-hook command: %s", cmd) _run_hook(cmd) - pre_hook.already[cmd] = True + pre_hook.already.add(cmd) elif cmd: logger.info("Pre-hook command already run, skipping: %s", cmd) -pre_hook.already = {} +pre_hook.already = set() def post_hook(config): diff --git a/certbot/tests/hook_test.py b/certbot/tests/hook_test.py index a8f49745b..3165a67fc 100644 --- a/certbot/tests/hook_test.py +++ b/certbot/tests/hook_test.py @@ -47,7 +47,7 @@ class HookTest(unittest.TestCase): return mock_logger.warning def test_pre_hook(self): - hooks.pre_hook.already = {} + hooks.pre_hook.already = set() config = mock.MagicMock(pre_hook="true") self._test_a_hook(config, hooks.pre_hook, 1) self._test_a_hook(config, hooks.pre_hook, 0)