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)