mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-29 12:09:37 +00:00
tor, torproxy: Avoid error if defaults file missing during uninstall
See: https://discuss.freedombox.org/t/error-when-uninstalling-tor-and-tor-proxy/4295 sunil: Use pathlib.Path.unlink() Tests: - Install Tor and Tor Proxy. Uninstall both. Uninstall is succesful. - Install Tor and Tor Proxy. Manually delete /var/run/tor-instances/*.defaults. Uninstall both apps. Uninstall is successful. A warning is printed in the logs. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
fce97a871a
commit
10069c4e5d
@ -494,5 +494,7 @@ def uninstall():
|
||||
for directory in directories:
|
||||
shutil.rmtree(directory, ignore_errors=True)
|
||||
|
||||
os.unlink(f'/var/run/tor-instances/{INSTANCE_NAME}.defaults')
|
||||
defaults_file = f'/var/run/tor-instances/{INSTANCE_NAME}.defaults'
|
||||
pathlib.Path(defaults_file).unlink(missing_ok=True)
|
||||
|
||||
action_utils.service_unmask(SERVICE_NAME)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"""Configure Tor Proxy service."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
from typing import Any
|
||||
|
||||
@ -190,5 +190,7 @@ def uninstall():
|
||||
for directory in directories:
|
||||
shutil.rmtree(directory, ignore_errors=True)
|
||||
|
||||
os.unlink(f'/var/run/tor-instances/{INSTANCE_NAME}.defaults')
|
||||
defaults_file = f'/var/run/tor-instances/{INSTANCE_NAME}.defaults'
|
||||
pathlib.Path(defaults_file).unlink(missing_ok=True)
|
||||
|
||||
action_utils.service_unmask(SERVICE_NAME)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user