Save/restore paused status in decorator to prevent functions like config-changed from overwriting it

This commit is contained in:
Corey Bryant 2015-10-12 14:28:22 +00:00
parent 346d5b4f4f
commit 3f1aca9849
1 changed files with 5 additions and 1 deletions

View File

@ -1001,7 +1001,11 @@ def pause_aware_restart_on_change(restart_map):
"""Avoids restarting services if config changes when unit is paused."""
def wrapper(f):
if is_paused():
return f
# save/restore paused status in case called function changes it
status, message = status_get()
ret = f
status_set(status, message)
return ret
else:
return restart_on_change(restart_map)(f)
return wrapper