mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-01-13 05:56:19 +00:00
Added checks and output to log wether configuration started properly or not
This commit is contained in:
@@ -127,8 +127,10 @@ class WireguardConfiguration:
|
|||||||
current_app.logger.info(f"Initialized Configuration: {name}")
|
current_app.logger.info(f"Initialized Configuration: {name}")
|
||||||
self.__dumpDatabase()
|
self.__dumpDatabase()
|
||||||
if self.getAutostartStatus() and not self.getStatus() and startup:
|
if self.getAutostartStatus() and not self.getStatus() and startup:
|
||||||
a, b = self.toggleConfiguration()
|
status, ext = self.toggleConfiguration()
|
||||||
print(a, b)
|
if not status:
|
||||||
|
current_app.logger.error(f"Failed to autostart configuration: {name}. Reason: {ext}")
|
||||||
|
else:
|
||||||
current_app.logger.info(f"Autostart Configuration: {name}")
|
current_app.logger.info(f"Autostart Configuration: {name}")
|
||||||
|
|
||||||
self.configurationInfo: WireguardConfigurationInfo | None = None
|
self.configurationInfo: WireguardConfigurationInfo | None = None
|
||||||
@@ -848,14 +850,12 @@ class WireguardConfiguration:
|
|||||||
try:
|
try:
|
||||||
check = subprocess.check_output(f"{self.Protocol}-quick down {self.Name}",
|
check = subprocess.check_output(f"{self.Protocol}-quick down {self.Name}",
|
||||||
shell=True, stderr=subprocess.STDOUT)
|
shell=True, stderr=subprocess.STDOUT)
|
||||||
print(check.decode())
|
|
||||||
self.removeAutostart()
|
self.removeAutostart()
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
return False, str(exc.output.strip().decode("utf-8"))
|
return False, str(exc.output.strip().decode("utf-8"))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
check = subprocess.check_output(f"{self.Protocol}-quick up {self.Name}", shell=True, stderr=subprocess.STDOUT)
|
check = subprocess.check_output(f"{self.Protocol}-quick up {self.Name}", shell=True, stderr=subprocess.STDOUT)
|
||||||
print(check.decode())
|
|
||||||
self.addAutostart()
|
self.addAutostart()
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
return False, str(exc.output.strip().decode("utf-8"))
|
return False, str(exc.output.strip().decode("utf-8"))
|
||||||
|
|||||||
Reference in New Issue
Block a user