From 1dc253a0980134b16c80b29bf194796d118c353a Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 4 Aug 2022 14:48:11 +0000 Subject: [PATCH] Ensure services are not started while unit paused Closes-Bug: #1983594 Change-Id: Ib05687d0146fee7609f36ca8692dafe0082846bc --- src/reactive/designate_handlers.py | 1 + unit_tests/test_designate_handlers.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/reactive/designate_handlers.py b/src/reactive/designate_handlers.py index da32ea1..efb5ef2 100644 --- a/src/reactive/designate_handlers.py +++ b/src/reactive/designate_handlers.py @@ -105,6 +105,7 @@ def config_rendered(): reactive.set_state('config.rendered') +@reactive.when_none('charm.paused') @reactive.when('config.rendered', 'base-config.rendered') def start_designate_services(): """Enable services when database is synchronized""" diff --git a/unit_tests/test_designate_handlers.py b/unit_tests/test_designate_handlers.py index 40147e8..282a2d9 100644 --- a/unit_tests/test_designate_handlers.py +++ b/unit_tests/test_designate_handlers.py @@ -73,6 +73,8 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks): 'when_none': { 'clear_dns_config_available': ( 'dns-slaves-config-valid', 'dns-backend.available', ), + 'start_designate_services': ( + 'charm.paused', ), }, 'when_file_changed': { 'local_pools_updated': ('/etc/designate/pools.yaml', ),