Improved Systemwide feedback errors to GUI
This commit is contained in:
parent
19b3925bd1
commit
a76ef50ed7
2 changed files with 22 additions and 8 deletions
|
|
@ -91,13 +91,13 @@ class ProfileController:
|
|||
if profile.is_system_profile():
|
||||
try:
|
||||
establish_connection(profile, ignore=ignore, connection_observer=connection_observer)
|
||||
if profile_observer is not None:
|
||||
profile_observer.notify('enabled', profile)
|
||||
except FirewallError:
|
||||
raise ProfileActivationError('Firewall could not be enabled.')
|
||||
raise
|
||||
except ConnectionError:
|
||||
raise ProfileActivationError('The profile could not be enabled.')
|
||||
|
||||
if profile_observer is not None:
|
||||
profile_observer.notify('enabled', profile)
|
||||
|
||||
@staticmethod
|
||||
def disable(profile: Union[SessionProfile, SystemProfile], explicitly: bool = True, ignore: tuple[type[Exception]] = (), profile_observer: ProfileObserver = None):
|
||||
|
|
@ -117,6 +117,15 @@ class ProfileController:
|
|||
|
||||
session_state.dissolve(session_state.id)
|
||||
|
||||
if profile_observer is not None:
|
||||
|
||||
profile_observer.notify('disabled', profile, dict(
|
||||
explicitly=explicitly,
|
||||
))
|
||||
|
||||
# ============================================================================
|
||||
# SYSTEMWIDE
|
||||
# ============================================================================
|
||||
if profile.is_system_profile():
|
||||
|
||||
subjects = ProfileController.get_all().values()
|
||||
|
|
@ -137,14 +146,20 @@ class ProfileController:
|
|||
|
||||
try:
|
||||
terminate_system_connection()
|
||||
if profile_observer is not None:
|
||||
profile_observer.notify('disabled', profile, dict(
|
||||
explicitly=explicitly,
|
||||
))
|
||||
except ConnectionTerminationError:
|
||||
raise ProfileDeactivationError('The profile could not be disabled.')
|
||||
except FirewallError:
|
||||
raise
|
||||
|
||||
if profile_observer is not None:
|
||||
# if profile_observer is not None:
|
||||
|
||||
profile_observer.notify('disabled', profile, dict(
|
||||
explicitly=explicitly,
|
||||
))
|
||||
# profile_observer.notify('disabled', profile, dict(
|
||||
# explicitly=explicitly,
|
||||
# ))
|
||||
|
||||
time.sleep(1.0)
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,6 @@ def establish_system_connection(
|
|||
2) Pass to private function
|
||||
3) Retry on failure
|
||||
"""
|
||||
|
||||
# ================= VERIFY ENDPOINT =================
|
||||
if ConfigurationController.get_endpoint_verification_enabled():
|
||||
verify_wireguard_endpoint(profile, ignore=ignore)
|
||||
|
|
|
|||
Loading…
Reference in a new issue