def METHOD_NAME(daemon=None):
    """Restart all Wazuh daemons."""
    try:
        control_service("start", daemon=daemon)
    except ValueError:
        pass
    yield
    control_service('stop', daemon=daemon)