tor: Don't check if enabled when not installed

Tests:

- Install Tor and enable onion service. Restart FreedomBox. During
initialization the onion service domain is added. Check in Name Services.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-09-10 17:45:02 -07:00 committed by James Valleroy
parent 9b9238188a
commit 7b7d42fe33
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -87,7 +87,9 @@ class TorApp(app_module.App):
self.add(users_and_groups)
# Register hidden service name with Name Services module.
if self.is_enabled() and app_is_running(self):
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup' and \
self.is_enabled() and app_is_running(self):
status = utils.get_status(initialized=False)
hostname = status['hs_hostname']
services = [int(port['virtport']) for port in status['hs_ports']]